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)
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.
15 #include <boost/concept_check.hpp>
27 // Define this macro if you want to hide the expected error, that is,
28 // error in the various C++ standard library implementations.
30 //#define BOOST_HIDE_EXPECTED_ERRORS
35 using namespace boost
;
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
41 typedef std::vector
<int> Vector
;
42 typedef std::deque
<int> Deque
;
43 typedef std::list
<int> List
;
45 // VC++ missing pointer and const_pointer typedefs
46 function_requires
< Mutable_RandomAccessContainer
<Vector
> >();
47 function_requires
< BackInsertionSequence
<Vector
> >();
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
> >();
55 // warnings about signed and unsigned in old deque version
56 function_requires
< FrontInsertionSequence
<Deque
> >();
57 function_requires
< BackInsertionSequence
<Deque
> >();
60 // VC++ missing pointer and const_pointer typedefs
61 function_requires
< Mutable_ReversibleContainer
<List
> >();
62 function_requires
< FrontInsertionSequence
<List
> >();
63 function_requires
< BackInsertionSequence
<List
> >();
66 typedef BOOST_STD_EXTENSION_NAMESPACE::slist
<int> SList
;
67 function_requires
< FrontInsertionSequence
<SList
> >();
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
;
75 function_requires
< SortedAssociativeContainer
<Set
> >();
76 function_requires
< SimpleAssociativeContainer
<Set
> >();
77 function_requires
< UniqueAssociativeContainer
<Set
> >();
79 function_requires
< SortedAssociativeContainer
<MultiSet
> >();
80 function_requires
< SimpleAssociativeContainer
<MultiSet
> >();
81 function_requires
< MultipleAssociativeContainer
<MultiSet
> >();
83 function_requires
< SortedAssociativeContainer
<Map
> >();
84 function_requires
< UniqueAssociativeContainer
<Map
> >();
85 function_requires
< PairAssociativeContainer
<Map
> >();
87 function_requires
< SortedAssociativeContainer
<MultiMap
> >();
88 function_requires
< MultipleAssociativeContainer
<MultiMap
> >();
89 function_requires
< PairAssociativeContainer
<MultiMap
> >();