PageRenderTime 28ms CodeModel.GetById 18ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/property_map/test/property_map_cc.cpp

http://hadesmem.googlecode.com/
C++ | 116 lines | 105 code | 3 blank | 8 comment | 0 complexity | eaba6857c90c258a6cdf047c6d2c95de MD5 | raw file
  1//  (C) Copyright Jeremy Siek 2001.
  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#include <boost/property_map/property_map.hpp>
  7#include <boost/property_map/shared_array_property_map.hpp>
  8#include <map>
  9
 10// This file checks the property map concepts against the property map
 11// archetypes to make sure they are consistent and that they compile.
 12// This also checks all the property map classes defined in
 13// property_map.hpp against the concept checking classes.
 14
 15int
 16main()
 17{
 18  using namespace boost;
 19  {
 20    typedef null_archetype<> Key;
 21    typedef assignable_archetype<copy_constructible_archetype<> > Value;
 22    typedef readable_property_map_archetype<Key, Value> PMap;
 23    function_requires<ReadablePropertyMapConcept<PMap, Key> >();
 24  }
 25  {
 26    typedef null_archetype<> Key;
 27    typedef assignable_archetype<copy_constructible_archetype<> > Value;
 28    typedef writable_property_map_archetype<Key, Value> PMap;
 29    function_requires<WritablePropertyMapConcept<PMap, Key> >();
 30  }
 31  {
 32    typedef null_archetype<> Key;
 33    typedef assignable_archetype<copy_constructible_archetype<> > Value;
 34    typedef read_write_property_map_archetype<Key, Value> PMap;
 35    function_requires<ReadWritePropertyMapConcept<PMap, Key> >();
 36  }
 37  {
 38    typedef null_archetype<> Key;
 39    typedef assignable_archetype<copy_constructible_archetype<> > Value;
 40    typedef lvalue_property_map_archetype<Key, Value> PMap;
 41    function_requires<LvaluePropertyMapConcept<PMap, Key> >();
 42  }
 43  {
 44    typedef null_archetype<> Key;
 45    typedef assignable_archetype<copy_constructible_archetype<> > Value;
 46    typedef mutable_lvalue_property_map_archetype<Key, Value> PMap;
 47    function_requires<Mutable_LvaluePropertyMapConcept<PMap, Key> >();
 48  }
 49  {
 50    typedef std::ptrdiff_t Key;
 51    typedef int* PMap;
 52    function_requires<Mutable_LvaluePropertyMapConcept<PMap, Key> >();
 53  }
 54  {
 55    typedef std::ptrdiff_t Key;
 56    typedef const int* PMap;
 57    function_requires<LvaluePropertyMapConcept<PMap, Key> >();
 58  }
 59  {
 60    typedef sgi_assignable_archetype<> Key; // ?
 61    typedef sgi_assignable_archetype<> Value;
 62    typedef random_access_iterator_archetype<Value> Iterator;
 63    typedef readable_property_map_archetype<Key, std::ptrdiff_t> IndexMap;
 64    typedef iterator_property_map<Iterator, IndexMap
 65#ifdef BOOST_NO_STD_ITERATOR_TRAITS
 66      , Value, const Value&
 67#endif
 68      > PMap;
 69    function_requires<LvaluePropertyMapConcept<PMap, Key> >();
 70  }
 71  {
 72    typedef sgi_assignable_archetype<> Key;
 73    typedef sgi_assignable_archetype<> Value;
 74    typedef mutable_random_access_iterator_archetype<Value> Iterator;
 75    typedef readable_property_map_archetype<Key, std::ptrdiff_t> IndexMap;
 76    typedef iterator_property_map<Iterator, IndexMap
 77#ifdef BOOST_NO_STD_ITERATOR_TRAITS
 78      , Value, Value&
 79#endif
 80      > PMap;
 81    function_requires<Mutable_LvaluePropertyMapConcept<PMap, Key> >();
 82  }
 83  {
 84    typedef sgi_assignable_archetype< less_than_comparable_archetype<> > Key;
 85    typedef default_constructible_archetype< sgi_assignable_archetype<> > 
 86      Value;
 87    typedef std::map<Key, Value> Container;
 88    typedef associative_property_map<Container> PMap;
 89    function_requires<Mutable_LvaluePropertyMapConcept<PMap, Key> >();
 90  }
 91  {
 92    typedef sgi_assignable_archetype< less_than_comparable_archetype<> > Key;
 93    typedef default_constructible_archetype< sgi_assignable_archetype<> > 
 94      Value;
 95    typedef std::map<Key, Value> Container;
 96    typedef const_associative_property_map<Container> PMap;
 97    function_requires<LvaluePropertyMapConcept<PMap, Key> >();
 98  }
 99  {
100    typedef identity_property_map PMap;
101    function_requires<ReadablePropertyMapConcept<PMap, int> >();
102  }
103  {
104    typedef dummy_property_map PMap;
105    function_requires<ReadWritePropertyMapConcept<PMap, int> >();
106  }
107  {
108    typedef sgi_assignable_archetype<> Key; // ?
109    typedef sgi_assignable_archetype<> Value;
110    typedef random_access_iterator_archetype<Value> Iterator;
111    typedef readable_property_map_archetype<Key, std::ptrdiff_t> IndexMap;
112    typedef shared_array_property_map<Value, IndexMap> PMap;
113    function_requires<Mutable_LvaluePropertyMapConcept<PMap, Key> >();
114  }
115  return 0;
116}