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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [libstdc++-v3/] [testsuite/] [util/] [testsuite_container_traits.h] - Blame information for rev 866

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

Line No. Rev Author Line
1 424 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_throwing_erase;
43
    typedef std::false_type     has_insert;
44
    typedef std::false_type     has_push_pop;
45
    typedef std::false_type     has_size_type_constructor;
46
  };
47
 
48
  // Primary template does nothing. Specialize on each type under
49
  // test, derive off of traits_base and just add the true traits.
50
  template<typename _Tp>
51
    struct traits;
52
 
53
  // Specialize for each container.
54
  template<typename _Tp, size_t _Np>
55
    struct traits<std::array<_Tp, _Np>> : public traits_base
56
    {
57
      typedef std::true_type    is_container;
58
      typedef std::true_type    is_reversible;
59
    };
60
 
61
  template<typename _Tp1, typename _Tp2>
62
    struct traits<std::deque<_Tp1, _Tp2>> : public traits_base
63
    {
64
      typedef std::true_type    is_container;
65
      typedef std::true_type    is_reversible;
66
      typedef std::true_type    is_allocator_aware;
67
 
68
      typedef std::true_type    has_erase;
69
      typedef std::true_type    has_throwing_erase;
70
      typedef std::true_type    has_insert;
71
      typedef std::true_type    has_push_pop;
72
      typedef std::true_type    has_size_type_constructor;
73
    };
74
 
75
  template<typename _Tp1, typename _Tp2>
76
    struct traits<std::forward_list<_Tp1, _Tp2>> : public traits_base
77
    {
78
      typedef std::true_type    is_container;
79
      typedef std::true_type    is_allocator_aware;
80
 
81
      typedef std::true_type    has_erase;
82
      typedef std::true_type    has_insert;
83
      typedef std::true_type    has_push_pop;
84
      typedef std::true_type    has_size_type_constructor;
85
    };
86
 
87
  template<typename _Tp1, typename _Tp2>
88
    struct traits<std::list<_Tp1, _Tp2>> : public traits_base
89
    {
90
      typedef std::true_type    is_container;
91
      typedef std::true_type    is_reversible;
92
      typedef std::true_type    is_allocator_aware;
93
 
94
      typedef std::true_type    has_erase;
95
      typedef std::true_type    has_insert;
96
      typedef std::true_type    has_push_pop;
97
      typedef std::true_type    has_size_type_constructor;
98
    };
99
 
100
  template<typename _Tp1, typename _Tp2>
101
    struct traits<std::vector<_Tp1, _Tp2>> : public traits_base
102
    {
103
      typedef std::true_type    is_container;
104
      typedef std::true_type    is_reversible;
105
      typedef std::true_type    is_allocator_aware;
106
 
107
      typedef std::true_type    has_erase;
108
      typedef std::true_type    has_throwing_erase;
109
      typedef std::true_type    has_insert;
110
      typedef std::true_type    has_size_type_constructor;
111
    };
112
 
113
  template<typename _Tp1, typename _Tp2, typename _Tp3>
114
    struct traits<std::basic_string<_Tp1, _Tp2, _Tp3>> : public traits_base
115
    {
116
      typedef std::true_type    is_container;
117
      typedef std::true_type    is_reversible;
118
      typedef std::true_type    is_allocator_aware;
119
 
120
      typedef std::true_type    has_erase;
121
      typedef std::true_type    has_insert;
122
    };
123
 
124
  template<typename _Tp1, typename _Tp2, typename _Tp3,
125
           template <typename, typename, typename> class _Tp4>
126
    struct traits<__gnu_cxx::__versa_string<_Tp1, _Tp2, _Tp3, _Tp4>>
127
    : public traits_base
128
    {
129
      typedef std::true_type    is_container;
130
      typedef std::true_type    is_reversible;
131
      typedef std::true_type    is_allocator_aware;
132
 
133
      typedef std::true_type    has_erase;
134
      typedef std::true_type    has_insert;
135
    };
136
 
137
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
138
    struct traits<std::map<_Tp1, _Tp2, _Tp3, _Tp4>> : public traits_base
139
    {
140
      typedef std::true_type    is_container;
141
      typedef std::true_type    is_reversible;
142
      typedef std::true_type    is_allocator_aware;
143
      typedef std::true_type    is_associative;
144
      typedef std::true_type    is_mapped;
145
 
146
      typedef std::true_type    has_erase;
147
      typedef std::true_type    has_insert;
148
    };
149
 
150
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
151
    struct traits<std::multimap<_Tp1, _Tp2, _Tp3, _Tp4>> : public traits_base
152
    {
153
      typedef std::true_type    is_container;
154
      typedef std::true_type    is_reversible;
155
      typedef std::true_type    is_allocator_aware;
156
      typedef std::true_type    is_associative;
157
      typedef std::true_type    is_mapped;
158
 
159
      typedef std::true_type    has_erase;
160
      typedef std::true_type    has_insert;
161
    };
162
 
163
  template<typename _Tp1, typename _Tp2, typename _Tp3>
164
    struct traits<std::set<_Tp1, _Tp2, _Tp3>> : public traits_base
165
    {
166
      typedef std::true_type    is_container;
167
      typedef std::true_type    is_reversible;
168
      typedef std::true_type    is_allocator_aware;
169
      typedef std::true_type    is_associative;
170
 
171
      typedef std::true_type    has_erase;
172
      typedef std::true_type    has_insert;
173
    };
174
 
175
  template<typename _Tp1, typename _Tp2, typename _Tp3>
176
    struct traits<std::multiset<_Tp1, _Tp2, _Tp3>> : public traits_base
177
    {
178
      typedef std::true_type    is_container;
179
      typedef std::true_type    is_reversible;
180
      typedef std::true_type    is_allocator_aware;
181
      typedef std::true_type    is_associative;
182
 
183
      typedef std::true_type    has_erase;
184
      typedef std::true_type    has_insert;
185
    };
186
 
187
  template<typename _Tp1, typename _Tp2>
188
    struct traits<std::priority_queue<_Tp1, _Tp2>> : public traits_base
189
    {
190
      typedef std::true_type    is_adaptor;
191
    };
192
 
193
  template<typename _Tp1, typename _Tp2>
194
    struct traits<std::queue<_Tp1, _Tp2>> : public traits_base
195
    {
196
      typedef std::true_type    is_adaptor;
197
    };
198
 
199
  template<typename _Tp1, typename _Tp2>
200
    struct traits<std::stack<_Tp1, _Tp2> > : public traits_base
201
    {
202
      typedef std::true_type    is_adaptor;
203
    };
204
 
205
  template<typename _Tp1, typename _Tp2, typename _Tp3,
206
           typename _Tp4, typename _Tp5>
207
    struct traits<std::unordered_map<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
208
    : public traits_base
209
    {
210
      typedef std::true_type    is_container;
211
      typedef std::true_type    is_allocator_aware;
212
      typedef std::true_type    is_unordered;
213
      typedef std::true_type    is_mapped;
214
 
215
      typedef std::true_type    has_erase;
216
      typedef std::true_type    has_insert;
217
    };
218
 
219
  template<typename _Tp1, typename _Tp2, typename _Tp3,
220
           typename _Tp4, typename _Tp5>
221
    struct traits<std::unordered_multimap<_Tp1, _Tp2, _Tp3, _Tp4, _Tp5>>
222
    : public traits_base
223
    {
224
      typedef std::true_type    is_container;
225
      typedef std::true_type    is_allocator_aware;
226
      typedef std::true_type    is_unordered;
227
      typedef std::true_type    is_mapped;
228
 
229
      typedef std::true_type    has_erase;
230
      typedef std::true_type    has_insert;
231
    };
232
 
233
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
234
    struct traits<std::unordered_multiset<_Tp1, _Tp2, _Tp3, _Tp4>>
235
    : public traits_base
236
    {
237
      typedef std::true_type    is_container;
238
      typedef std::true_type    is_allocator_aware;
239
      typedef std::true_type    is_unordered;
240
 
241
      typedef std::true_type    has_erase;
242
      typedef std::true_type    has_insert;
243
    };
244
 
245
  template<typename _Tp1, typename _Tp2, typename _Tp3, typename _Tp4>
246
    struct traits<std::unordered_set<_Tp1, _Tp2, _Tp3, _Tp4>>
247
    : public traits_base
248
    {
249
      typedef std::true_type    is_container;
250
      typedef std::true_type    is_allocator_aware;
251
      typedef std::true_type    is_unordered;
252
 
253
      typedef std::true_type    has_erase;
254
      typedef std::true_type    has_insert;
255
    };
256
} // namespace __gnu_test
257
 
258
#endif

powered by: WebSVN 2.1.0

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