]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/allocator/requirements/typedefs.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / allocator / requirements / typedefs.cc
1 // { dg-options "-std=gnu++11" }
2 // { dg-do compile }
3
4 // Copyright (C) 2012-2016 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16
17 // You should have received a copy of the GNU General Public License
18 // along with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
20
21
22 #include <memory>
23 #include <type_traits>
24
25 // Check std::allocator for required typedefs.
26
27 using std::is_same;
28 using std::allocator;
29
30 static_assert( is_same<allocator<int>::size_type, std::size_t>::value,
31 "size_type" );
32 static_assert( is_same<allocator<int>::difference_type, std::ptrdiff_t>::value,
33 "difference_type" );
34 static_assert( is_same<allocator<int>::pointer, int*>::value,
35 "pointer" );
36 static_assert( is_same<allocator<int>::const_pointer, const int*>::value,
37 "const_pointer" );
38 static_assert( is_same<allocator<int>::reference, int&>::value,
39 "reference" );
40 static_assert( is_same<allocator<int>::const_reference, const int&>::value,
41 "const_reference" );
42 static_assert( is_same<allocator<int>::value_type, int>::value,
43 "value_type" );
44
45 static_assert( is_same<allocator<int>::rebind<char>::other,
46 allocator<char>>::value,
47 "rebind::other" );
48
49 static_assert( is_same<allocator<int>::propagate_on_container_move_assignment,
50 std::true_type>::value,
51 "propagate_on_container_move_assignment" );