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

38 lines
825 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/lightweight_test.hpp>
2020-05-25 15:00:18 -04:00
template<class T>
2020-04-13 01:43:43 -04:00
struct A1 {
2020-05-25 15:00:18 -04:00
typedef T value_type;
A1(int n)
: value(n) { }
2020-04-13 01:43:43 -04:00
int value;
};
2020-05-25 15:00:18 -04:00
template<class T>
2020-04-13 01:43:43 -04:00
struct A2 {
2020-05-25 15:00:18 -04:00
typedef T value_type;
A2(int n)
: value(n) { }
2020-04-13 01:43:43 -04:00
A2 select_on_container_copy_construction() const {
return A2(value + 1);
}
int value;
};
int main()
{
2020-05-25 15:00:18 -04:00
BOOST_TEST_EQ(1, boost::
allocator_select_on_container_copy_construction(A1<int>(1)).value);
BOOST_TEST_EQ(2, boost::
allocator_select_on_container_copy_construction(A2<int>(1)).value);
2020-04-13 01:43:43 -04:00
return boost::report_errors();
}