]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do compile { target c++11 } } |
677aad9c | 2 | // |
a945c346 | 3 | // Copyright (C) 2011-2024 Free Software Foundation, Inc. |
677aad9c JW |
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 | ||
677aad9c JW |
25 | template<typename T> |
26 | struct minimal_allocator | |
27 | { | |
28 | typedef T value_type; | |
29 | minimal_allocator(); | |
30 | template <typename U> | |
31 | minimal_allocator(const minimal_allocator<U>&); | |
32 | T* allocate(unsigned long); | |
33 | void deallocate(T*, unsigned long); | |
34 | }; | |
35 | ||
36 | struct S | |
37 | { | |
38 | typedef minimal_allocator<short> allocator_type; | |
39 | S(const allocator_type&); | |
40 | }; | |
41 | ||
42 | void test01() | |
43 | { | |
44 | typedef minimal_allocator<S> outer_type; | |
45 | typedef minimal_allocator<S::allocator_type> inner_type; | |
46 | typedef std::scoped_allocator_adaptor<outer_type, inner_type> test_type; | |
47 | ||
48 | // Check for required typedefs | |
49 | typedef typename test_type::outer_allocator_type outer_allocator_type; | |
50 | typedef typename test_type::inner_allocator_type inner_allocator_type; | |
51 | typedef typename test_type::value_type value_type; | |
52 | typedef typename test_type::size_type size_type; | |
53 | typedef typename test_type::difference_type difference_type; | |
54 | typedef typename test_type::pointer pointer; | |
55 | typedef typename test_type::const_pointer const_pointer; | |
56 | typedef typename test_type::void_pointer void_pointer; | |
57 | typedef typename test_type::const_void_pointer const_void_pointer; | |
58 | typedef typename test_type::propagate_on_container_copy_assignment | |
59 | propagate_on_container_copy_assignment; | |
60 | typedef typename test_type::propagate_on_container_move_assignment | |
61 | propagate_on_container_move_assignment; | |
62 | typedef typename test_type::propagate_on_container_swap | |
63 | propagate_on_container_swap; | |
64 | } | |
65 |