]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/concept_check/test/stl_concept_check.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / concept_check / test / stl_concept_check.cpp
1 // (C) Copyright Jeremy Siek 2000.
2 // Distributed under the Boost Software License, Version 1.0. (See
3 // accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
5
6 //
7 // This file checks to see if various standard container
8 // implementations live up to requirements specified in the C++
9 // standard. As many implementations do not live to the requirements,
10 // it is not uncommon for this file to fail to compile. The
11 // BOOST_HIDE_EXPECTED_ERRORS macro is provided here if you want to
12 // see as much of this file compile as possible.
13 //
14
15 #include <boost/concept_check.hpp>
16
17 #include <iterator>
18 #include <set>
19 #include <map>
20 #include <vector>
21 #include <list>
22 #include <deque>
23 #if 0
24 #include <slist>
25 #endif
26
27 // Define this macro if you want to hide the expected error, that is,
28 // error in the various C++ standard library implementations.
29 //
30 //#define BOOST_HIDE_EXPECTED_ERRORS
31
32 int
33 main()
34 {
35 using namespace boost;
36
37 #if defined(_ITERATOR_) && defined(BOOST_HIDE_EXPECTED_ERRORS)
38 // VC++ STL implementation is not standard conformant and
39 // fails to pass these concept checks
40 #else
41 typedef std::vector<int> Vector;
42 typedef std::deque<int> Deque;
43 typedef std::list<int> List;
44
45 // VC++ missing pointer and const_pointer typedefs
46 function_requires< Mutable_RandomAccessContainer<Vector> >();
47 function_requires< BackInsertionSequence<Vector> >();
48
49 #if !(defined(__GNUC__) && defined(BOOST_HIDE_EXPECTED_ERRORS))
50 #if !((defined(__sgi) || (defined(__DECCXX) && defined(_RWSTD_VER) && _RWSTD_VER <= 0x0203)) \
51 && defined(BOOST_HIDE_EXPECTED_ERRORS))
52 // old deque iterator missing n + iter operation
53 function_requires< Mutable_RandomAccessContainer<Deque> >();
54 #endif
55 // warnings about signed and unsigned in old deque version
56 function_requires< FrontInsertionSequence<Deque> >();
57 function_requires< BackInsertionSequence<Deque> >();
58 #endif
59
60 // VC++ missing pointer and const_pointer typedefs
61 function_requires< Mutable_ReversibleContainer<List> >();
62 function_requires< FrontInsertionSequence<List> >();
63 function_requires< BackInsertionSequence<List> >();
64
65 #if 0
66 typedef BOOST_STD_EXTENSION_NAMESPACE::slist<int> SList;
67 function_requires< FrontInsertionSequence<SList> >();
68 #endif
69
70 typedef std::set<int> Set;
71 typedef std::multiset<int> MultiSet;
72 typedef std::map<int,int> Map;
73 typedef std::multimap<int,int> MultiMap;
74
75 function_requires< SortedAssociativeContainer<Set> >();
76 function_requires< SimpleAssociativeContainer<Set> >();
77 function_requires< UniqueAssociativeContainer<Set> >();
78
79 function_requires< SortedAssociativeContainer<MultiSet> >();
80 function_requires< SimpleAssociativeContainer<MultiSet> >();
81 function_requires< MultipleAssociativeContainer<MultiSet> >();
82
83 function_requires< SortedAssociativeContainer<Map> >();
84 function_requires< UniqueAssociativeContainer<Map> >();
85 function_requires< PairAssociativeContainer<Map> >();
86
87 function_requires< SortedAssociativeContainer<MultiMap> >();
88 function_requires< MultipleAssociativeContainer<MultiMap> >();
89 function_requires< PairAssociativeContainer<MultiMap> >();
90 #endif
91
92 return 0;
93 }