]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/scoped_allocator/requirements/typedefs.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / scoped_allocator / requirements / typedefs.cc
1 // { dg-options "-std=gnu++11" }
2 //
3 // Copyright (C) 2011-2015 Free Software Foundation, Inc.
4 //
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
9 // any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
19
20 //
21 // NB: This file is for testing scoped_allocator with NO OTHER INCLUDES.
22
23 #include <scoped_allocator>
24
25 // { dg-do compile }
26
27 template<typename T>
28 struct minimal_allocator
29 {
30 typedef T value_type;
31 minimal_allocator();
32 template <typename U>
33 minimal_allocator(const minimal_allocator<U>&);
34 T* allocate(unsigned long);
35 void deallocate(T*, unsigned long);
36 };
37
38 struct S
39 {
40 typedef minimal_allocator<short> allocator_type;
41 S(const allocator_type&);
42 };
43
44 void test01()
45 {
46 typedef minimal_allocator<S> outer_type;
47 typedef minimal_allocator<S::allocator_type> inner_type;
48 typedef std::scoped_allocator_adaptor<outer_type, inner_type> test_type;
49
50 // Check for required typedefs
51 typedef typename test_type::outer_allocator_type outer_allocator_type;
52 typedef typename test_type::inner_allocator_type inner_allocator_type;
53 typedef typename test_type::value_type value_type;
54 typedef typename test_type::size_type size_type;
55 typedef typename test_type::difference_type difference_type;
56 typedef typename test_type::pointer pointer;
57 typedef typename test_type::const_pointer const_pointer;
58 typedef typename test_type::void_pointer void_pointer;
59 typedef typename test_type::const_void_pointer const_void_pointer;
60 typedef typename test_type::propagate_on_container_copy_assignment
61 propagate_on_container_copy_assignment;
62 typedef typename test_type::propagate_on_container_move_assignment
63 propagate_on_container_move_assignment;
64 typedef typename test_type::propagate_on_container_swap
65 propagate_on_container_swap;
66 }
67