| 1 | /* |
|---|---|
| 2 | Copyright 2020 Glen Joseph Fernandes |
| 3 | (glenjofe@gmail.com) |
| 4 | |
| 5 | Distributed 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 | |
| 11 | template<class T> |
| 12 | struct A { |
| 13 | typedef T value_type; |
| 14 | typedef T* pointer; |
| 15 | typedef std::size_t size_type; |
| 16 | A() |
| 17 | : value() { } |
| 18 | void deallocate(T*, std::size_t n) { |
| 19 | value = n; |
| 20 | } |
| 21 | std::size_t value; |
| 22 | }; |
| 23 | |
| 24 | int main() |
| 25 | { |
| 26 | A<int> a; |
| 27 | boost::allocator_deallocate(a, p: 0, n: 5); |
| 28 | BOOST_TEST_EQ(a.value, 5); |
| 29 | return boost::report_errors(); |
| 30 | } |
| 31 |
