1 // Boost.Bimap 2 // 3 // Copyright (c) 2006-2007 Matias Capeletto 4 // 5 // Distributed under the Boost Software License, Version 1.0. 6 // (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 9 /// \file container_adaptor/vector_map_adaptor.hpp 10 /// \brief Container adaptor. 11 12 #ifndef BOOST_BIMAP_CONTAINER_ADAPTOR_VECTOR_MAP_ADAPTOR_HPP 13 #define BOOST_BIMAP_CONTAINER_ADAPTOR_VECTOR_MAP_ADAPTOR_HPP 14 15 #if defined(_MSC_VER) 16 #pragma once 17 #endif 18 19 #include <boost/config.hpp> 20 21 #include <boost/mpl/list.hpp> 22 #include <boost/mpl/push_front.hpp> 23 #include <boost/mpl/aux_/na.hpp> 24 #include <boost/bimap/container_adaptor/vector_adaptor.hpp> 25 #include <boost/bimap/container_adaptor/detail/identity_converters.hpp> 26 #include <boost/mpl/vector.hpp> 27 28 namespace boost { 29 namespace bimaps { 30 namespace container_adaptor { 31 32 /// \brief Container adaptor. 33 34 template 35 < 36 class Base, 37 38 class Iterator, 39 class ConstIterator, 40 class ReverseIterator, 41 class ConstReverseIterator, 42 43 class IteratorToBaseConverter = ::boost::mpl::na, 44 class IteratorFromBaseConverter = ::boost::mpl::na, 45 class ReverseIteratorFromBaseConverter = ::boost::mpl::na, 46 class ValueToBaseConverter = ::boost::mpl::na, 47 class ValueFromBaseConverter = ::boost::mpl::na, 48 49 class FunctorsFromDerivedClasses = mpl::vector<> 50 > 51 class vector_map_adaptor : 52 53 public vector_adaptor 54 < 55 Base, 56 Iterator, ConstIterator, ReverseIterator, ConstReverseIterator, 57 IteratorToBaseConverter, IteratorFromBaseConverter, 58 ReverseIteratorFromBaseConverter, 59 ValueToBaseConverter, ValueFromBaseConverter, 60 FunctorsFromDerivedClasses 61 > 62 { 63 typedef vector_adaptor 64 < 65 Base, 66 Iterator, ConstIterator, ReverseIterator, ConstReverseIterator, 67 IteratorToBaseConverter, IteratorFromBaseConverter, 68 ReverseIteratorFromBaseConverter, 69 ValueToBaseConverter, ValueFromBaseConverter, 70 FunctorsFromDerivedClasses 71 72 > base_; 73 74 // MetaData ------------------------------------------------------------- 75 76 public: 77 78 typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::first_type key_type; 79 typedef BOOST_DEDUCED_TYPENAME Iterator::value_type::second_type data_type; 80 typedef data_type mapped_type; 81 82 // Access ----------------------------------------------------------------- 83 84 public: 85 vector_map_adaptor()86 vector_map_adaptor() {} 87 vector_map_adaptor(Base & c)88 explicit vector_map_adaptor(Base & c) : 89 base_(c) {} 90 91 protected: 92 93 typedef vector_map_adaptor vector_map_adaptor_; 94 95 }; 96 97 98 } // namespace container_adaptor 99 } // namespace bimaps 100 } // namespace boost 101 102 103 #endif // BOOST_BIMAP_CONTAINER_ADAPTOR_VECTOR_MAP_ADAPTOR_HPP 104 105