2020-04-13 01:43:43 -04:00
|
|
|
/*
|
|
|
|
Copyright 2020 Glen Joseph Fernandes
|
|
|
|
(glenjofe@gmail.com)
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
|
|
(http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
#include <boost/core/allocator_access.hpp>
|
|
|
|
#include <boost/core/lightweight_test.hpp>
|
|
|
|
|
2020-05-25 15:00:18 -04:00
|
|
|
template<class T>
|
2020-04-13 01:43:43 -04:00
|
|
|
struct A {
|
2020-05-25 15:00:18 -04:00
|
|
|
typedef T value_type;
|
|
|
|
typedef T* pointer;
|
|
|
|
typedef std::size_t size_type;
|
2020-04-13 01:43:43 -04:00
|
|
|
A()
|
|
|
|
: value() { }
|
2020-05-25 15:00:18 -04:00
|
|
|
T* allocate(std::size_t n) {
|
2020-04-13 01:43:43 -04:00
|
|
|
value = n;
|
2020-05-25 15:00:18 -04:00
|
|
|
return 0;
|
2020-04-13 01:43:43 -04:00
|
|
|
}
|
2020-05-25 15:00:18 -04:00
|
|
|
std::size_t value;
|
2020-04-13 01:43:43 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2020-05-25 15:00:18 -04:00
|
|
|
A<int> a;
|
|
|
|
BOOST_TEST_NOT(boost::allocator_allocate(a, 5));
|
|
|
|
BOOST_TEST_EQ(a.value, 5);
|
2020-04-13 01:43:43 -04:00
|
|
|
return boost::report_errors();
|
|
|
|
}
|