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 A1 {
13 typedef T value_type;
14 A1(int n)
15 : value(n) { }
16 int value;
17};
18
19template<class T>
20struct A2 {
21 typedef T value_type;
22 A2(int n)
23 : value(n) { }
24 A2 select_on_container_copy_construction() const {
25 return A2(value + 1);
26 }
27 int value;
28};
29
30int main()
31{
32 BOOST_TEST_EQ(1, boost::
33 allocator_select_on_container_copy_construction(A1<int>(1)).value);
34 BOOST_TEST_EQ(2, boost::
35 allocator_select_on_container_copy_construction(A2<int>(1)).value);
36 return boost::report_errors();
37}
38

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