OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libstdc++-v3/] [testsuite/] [util/] [testsuite_container_traits.h] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 742 jeremybenn
// -*- C++ -*-
2
 
3
// Copyright (C) 2009, 2010 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 terms
7
// of the GNU General Public License as published by the Free Software
8
// Foundation; either version 3, or (at your option) any later
9
// version.
10
 
11
// This library is distributed in the hope that it will be useful, but
12
// WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
// 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
#ifndef _GLIBCXX_TESTSUITE_CONTAINER_TRAITS_H
21
#define _GLIBCXX_TESTSUITE_CONTAINER_TRAITS_H
22
 
23
#include <bits/stdc++.h>
24
#include <ext/vstring.h>
25
 
26
namespace __gnu_test
27
{
28
  // Container traits.
29
  // Base class with default false values for all traits.
30
  struct traits_base
31
  {
32
    // Type, nested type, and typedef related traits.
33
    typedef std::false_type     is_container;
34
    typedef std::false_type     is_adaptor;
35
    typedef std::false_type     is_reversible;
36
    typedef std::false_type     is_allocator_aware;
37
    typedef std::false_type     is_associative;
38
    typedef std::false_type     is_unordered;
39
    typedef std::false_type     is_mapped;
40
 
41
    typedef std::false_type     has_erase;
42
    typedef std::false_type     has_erase_after;
43
    typedef std::false_type     has_throwing_erase;
44
    typedef std::false_type     has_insert;
45
    typedef std::false_type     has_insert_after;
46
    typedef std::false_type     has_emplace;
47
    typedef std::false_type     has_push_pop;
48
    typedef std::false_type     has_size_type_constructor;
49
  };
50
 
51
  // Primary template does nothing. Specialize on each type under
52
  // test, derive off of traits_base and just add the true traits.
53
  template<typename _Tp>
54
    struct traits;
55
 
56
  // Specialize for each container.
57
  template<typename _Tp, size_t _Np>
58
    struct traits<std::array<_Tp, _Np>> : public traits_base
59
    {
60
      typedef std::true_type    is_container;
61
      typedef std::true_type    is_reversible;
62
    };
63
 
64
  template<typename _Tp1, typename _Tp2>
65
    struct traits<std::deque<_Tp1, _Tp2>> : public traits_base
66
    {
67
      typedef std::true_type    is_container;
68
      typedef std::true_type    is_reversible;
69
      typedef std::true_type    is_allocator_aware;
70
 
71
      typedef std::true_type    has_erase;
72
      typedef std::true_type    has_throwing_erase;
73
      typedef std::true_type    has_insert;
74
      typedef std::true_type    has_push_pop;
75
      typedef std::true_type    has_size_type_constructor;
76
    };
77
 
78
  template<typename _Tp1, typename _Tp2>
79
    struct traits<std::forward_list<_Tp1, _Tp2>> : public traits_base
80
    {
81
      typedef std::true_type    is_container;
82
      typedef std::true_type    is_allocator_aware;
83
 
84
      typedef std::true_type    has_erase_after;
85
      typedef std::true_type    has_insert_after;
86
      typedef std::true_type    has_push_pop;
87
      typedef std::true_type    has_size_type_constructor;
88
    };
89
 
90
  template<typename _Tp1, typename _Tp2>
91
    struct traits<std::list<_Tp1, _Tp2>> : public traits_base
92
    {
93
      typedef std::true_type    is_container;
94
      typedef std::true_type    is_reversible;
95
      typedef std::true_type    is_allocator_aware;
96
 
97
      typedef std::true_type    has_erase;
98
      typedef std::true_type    has_insert;
99
      typedef std::true_type    has_push_pop;
100
      typedef std::true_type    has_size_type_constructor;
101
    };
102
 
103
  template<typename _Tp1, typename _Tp2>
104
    struct traits<std::vector<_Tp1, _Tp2>> : public traits_base
105
    {
106
      typedef std::true_type    is_container;
107
      typedef std::true_type    is_reversible;
108
      typedef std::true_type    is_allocator_aware;
109
 
110
      typedef std::true_type    has_erase;
111
      typedef std::true_type    has_throwing_erase;
112
      typedef std::true_type    has_insert;
113
      typedef std::true_type    has_size_type_constructor;
114
    };
115
 
116
  template<typename _Tp1, typename _Tp2, typename _Tp3>
117
    struct traits<std::basic_string<_Tp1, _Tp2, _Tp3>> : public traits_base
118
    {
119
      typedef std::true_type    is_container;
120
      typedef std::true_type    is_reversible;
121
      typedef std::true_type    is_allocator_aware;
122
 
123
      typedef std::true_type    has_erase;
124
      typedef std::true_type    has_insert;
125
    };
126
 
127
  template<typename _Tp1, typename _Tp2, typename _Tp3,
128
           template <typename, typename, typename> class _Tp4>
129
    struct traits<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
130
    : public traits_base
131
    {
132
      typedef std::true_type    is_container;
133
      typedef std::true_type    is_reversible;
134
      typedef std::true_type    is_allocator_aware;
135
 
136
      typedef std::true_type    has_erase;
137
      typedef std::true_type    has_insert;
138
    };
139
 
140
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
141
    struct traits<std::map<_Tp1, _Tp2, _Tp3, _Tp4>> : public traits_base
142
    {
143
      typedef std::true_type    is_container;
144
      typedef std::true_type    is_reversible;
145
      typedef std::true_type    is_allocator_aware;
146
      typedef std::true_type    is_associative;
147
      typedef std::true_type    is_mapped;
148
 
149
      typedef std::true_type    has_erase;
150
      typedef std::true_type    has_insert;
151
    };
152
 
153
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
154
    struct traits<std::multimap<_Tp1, _Tp2, _Tp3, _Tp4>> : public traits_base
155
    {
156
      typedef std::true_type    is_container;
157
      typedef std::true_type    is_reversible;
158
      typedef std::true_type    is_allocator_aware;
159
      typedef std::true_type    is_associative;
160
      typedef std::true_type    is_mapped;
161
 
162
      typedef std::true_type    has_erase;
163
      typedef std::true_type    has_insert;
164
    };
165
 
166
  template<typename _Tp1, typename _Tp2, typename _Tp3>
167
    struct traits<std::set<_Tp1, _Tp2, _Tp3>> : public traits_base
168
    {
169
      typedef std::true_type    is_container;
170
      typedef std::true_type    is_reversible;
171
      typedef std::true_type    is_allocator_aware;
172
      typedef std::true_type    is_associative;
173
 
174
      typedef std::true_type    has_erase;
175
      typedef std::true_type    has_insert;
176
    };
177
 
178
  template<typename _Tp1, typename _Tp2, typename _Tp3>
179
    struct traits<std::multiset<_Tp1, _Tp2, _Tp3>> : public traits_base
180
    {
181
      typedef std::true_type    is_container;
182
      typedef std::true_type    is_reversible;
183
      typedef std::true_type    is_allocator_aware;
184
      typedef std::true_type    is_associative;
185
 
186
      typedef std::true_type    has_erase;
187
      typedef std::true_type    has_insert;
188
    };
189
 
190
  template<typename _Tp1, typename _Tp2>
191
    struct traits<std::priority_queue<_Tp1, _Tp2>> : public traits_base
192
    {
193
      typedef std::true_type    is_adaptor;
194
    };
195
 
196
  template<typename _Tp1, typename _Tp2>
197
    struct traits<std::queue<_Tp1, _Tp2>> : public traits_base
198
    {
199
      typedef std::true_type    is_adaptor;
200
    };
201
 
202
  template<typename _Tp1, typename _Tp2>
203
    struct traits<std::stack<_Tp1, _Tp2> > : public traits_base
204
    {
205
      typedef std::true_type    is_adaptor;
206
    };
207
 
208
  template<typename _Tp1, typename _Tp2, typename _Tp3,
209
           typename _Tp4, typename _Tp5>
210
    struct traits<std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
211
    : public traits_base
212
    {
213
      typedef std::true_type    is_container;
214
      typedef std::true_type    is_allocator_aware;
215
      typedef std::true_type    is_unordered;
216
      typedef std::true_type    is_mapped;
217
 
218
      typedef std::true_type    has_erase;
219
      typedef std::true_type    has_insert;
220
      typedef std::true_type    has_emplace;
221
    };
222
 
223
  template<typename _Tp1, typename _Tp2, typename _Tp3,
224
           typename _Tp4, typename _Tp5>
225
    struct traits<std::unordered_multimap<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
226
    : public traits_base
227
    {
228
      typedef std::true_type    is_container;
229
      typedef std::true_type    is_allocator_aware;
230
      typedef std::true_type    is_unordered;
231
      typedef std::true_type    is_mapped;
232
 
233
      typedef std::true_type    has_erase;
234
      typedef std::true_type    has_insert;
235
      typedef std::true_type    has_emplace;
236
    };
237
 
238
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
239
    struct traits<std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>>
240
    : public traits_base
241
    {
242
      typedef std::true_type    is_container;
243
      typedef std::true_type    is_allocator_aware;
244
      typedef std::true_type    is_unordered;
245
 
246
      typedef std::true_type    has_erase;
247
      typedef std::true_type    has_insert;
248
      typedef std::true_type    has_emplace;
249
    };
250
 
251
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
252
    struct traits<std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>>
253
    : public traits_base
254
    {
255
      typedef std::true_type    is_container;
256
      typedef std::true_type    is_allocator_aware;
257
      typedef std::true_type    is_unordered;
258
 
259
      typedef std::true_type    has_erase;
260
      typedef std::true_type    has_insert;
261
      typedef std::true_type    has_emplace;
262
    };
263
} // namespace __gnu_test
264
 
265
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.