Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/concept_check/stl_concept_check.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 3.2 KB
Line 
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#ifndef BOOST_NO_SLIST
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
32int
33main()
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_RandomAccessContainerConcept<Vector> >();
47  function_requires< BackInsertionSequenceConcept<Vector> >();
48
49#if !(defined(__GNUC__) && defined(BOOST_HIDE_EXPECTED_ERRORS))
50#if !(defined(__sgi) && defined(BOOST_HIDE_EXPECTED_ERRORS))
51  // old deque iterator missing n + iter operation
52  function_requires< Mutable_RandomAccessContainerConcept<Deque> >();
53#endif
54  // warnings about signed and unsigned in old deque version
55  function_requires< FrontInsertionSequenceConcept<Deque> >();
56  function_requires< BackInsertionSequenceConcept<Deque> >();
57#endif
58
59  // VC++ missing pointer and const_pointer typedefs
60  function_requires< Mutable_ReversibleContainerConcept<List> >();
61  function_requires< FrontInsertionSequenceConcept<List> >();
62  function_requires< BackInsertionSequenceConcept<List> >();
63
64#ifndef BOOST_NO_SLIST
65  typedef BOOST_STD_EXTENSION_NAMESPACE::slist<int> SList;
66  function_requires< FrontInsertionSequenceConcept<SList> >();
67#endif
68
69  typedef std::set<int> Set;
70  typedef std::multiset<int> MultiSet;
71  typedef std::map<int,int> Map;
72  typedef std::multimap<int,int> MultiMap;
73
74  function_requires< SortedAssociativeContainerConcept<Set> >();
75  function_requires< SimpleAssociativeContainerConcept<Set> >();
76  function_requires< UniqueAssociativeContainerConcept<Set> >();
77
78  function_requires< SortedAssociativeContainerConcept<MultiSet> >();
79  function_requires< SimpleAssociativeContainerConcept<MultiSet> >();
80  function_requires< MultipleAssociativeContainerConcept<MultiSet> >();
81
82  function_requires< SortedAssociativeContainerConcept<Map> >();
83  function_requires< UniqueAssociativeContainerConcept<Map> >();
84  function_requires< PairAssociativeContainerConcept<Map> >();
85
86  function_requires< SortedAssociativeContainerConcept<MultiMap> >();
87  function_requires< MultipleAssociativeContainerConcept<MultiMap> >();
88  function_requires< PairAssociativeContainerConcept<MultiMap> >();
89#endif
90
91  return 0;
92}
Note: See TracBrowser for help on using the repository browser.