1/*
2Copyright 2020 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed under the Boost Software License, Version 1.0.
6(http://www.boost.org/LICENSE_1_0.txt)
7*/
8#include <boost/core/allocator_access.hpp>
9#include <boost/core/lightweight_test.hpp>
10
11template<class T>
12struct A {
13 typedef T value_type;
14 typedef T* pointer;
15 typedef std::size_t size_type;
16 A()
17 : value() { }
18 T* allocate(std::size_t n) {
19 value = n;
20 return 0;
21 }
22 std::size_t value;
23};
24
25int main()
26{
27 A<int> a;
28 BOOST_TEST_NOT(boost::allocator_allocate(a, 5));
29 BOOST_TEST_EQ(a.value, 5);
30 return boost::report_errors();
31}
32

source code of boost/libs/core/test/allocator_allocate_test.cpp