1
0
forked from boostorg/core
Files
boost_core/test/allocator_rebind_test.cpp

34 lines
767 B
C++
Raw Normal View History

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/is_same.hpp>
#include <boost/core/lightweight_test_trait.hpp>
2020-05-25 15:00:18 -04:00
template<class T>
struct A1 {
typedef T value_type;
template<class>
2020-04-13 01:43:43 -04:00
struct rebind {
2020-05-25 15:00:18 -04:00
typedef A1<int> other;
2020-04-13 01:43:43 -04:00
};
};
2020-05-25 15:00:18 -04:00
template<class T>
struct A2 {
typedef T value_type;
};
2020-04-13 01:43:43 -04:00
int main()
{
2020-05-25 15:00:18 -04:00
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<A1<int>,
boost::allocator_rebind<A1<char>, bool>::type>));
BOOST_TEST_TRAIT_TRUE((boost::core::is_same<A2<int>,
boost::allocator_rebind<A2<char>, int>::type>));
2020-04-13 01:43:43 -04:00
return boost::report_errors();
}