File indexing completed on 2025-01-18 09:29:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef BOOST_BIMAP_CONTAINER_ADAPTOR_VECTOR_ADAPTOR_HPP
0013 #define BOOST_BIMAP_CONTAINER_ADAPTOR_VECTOR_ADAPTOR_HPP
0014
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018
0019 #include <boost/config.hpp>
0020
0021 #include <boost/bimap/container_adaptor/sequence_container_adaptor.hpp>
0022 #include <boost/mpl/aux_/na.hpp>
0023 #include <boost/mpl/vector.hpp>
0024
0025 namespace boost {
0026 namespace bimaps {
0027 namespace container_adaptor {
0028
0029
0030
0031 template
0032 <
0033 class Base,
0034
0035 class Iterator,
0036 class ConstIterator,
0037 class ReverseIterator,
0038 class ConstReverseIterator,
0039
0040 class IteratorToBaseConverter = ::boost::mpl::na,
0041 class IteratorFromBaseConverter = ::boost::mpl::na,
0042 class ReverseIteratorFromBaseConverter = ::boost::mpl::na,
0043 class ValueToBaseConverter = ::boost::mpl::na,
0044 class ValueFromBaseConverter = ::boost::mpl::na,
0045
0046 class FunctorsFromDerivedClasses = mpl::vector<>
0047 >
0048 class vector_adaptor :
0049
0050 public ::boost::bimaps::container_adaptor::sequence_container_adaptor
0051 <
0052 Base,
0053 Iterator, ConstIterator, ReverseIterator, ConstReverseIterator,
0054 IteratorToBaseConverter, IteratorFromBaseConverter,
0055 ReverseIteratorFromBaseConverter,
0056 ValueToBaseConverter, ValueFromBaseConverter,
0057 FunctorsFromDerivedClasses
0058 >
0059 {
0060
0061 typedef ::boost::bimaps::container_adaptor::sequence_container_adaptor
0062 <
0063 Base,
0064 Iterator, ConstIterator, ReverseIterator, ConstReverseIterator,
0065 IteratorToBaseConverter, IteratorFromBaseConverter,
0066 ReverseIteratorFromBaseConverter,
0067 ValueToBaseConverter, ValueFromBaseConverter,
0068 FunctorsFromDerivedClasses
0069
0070 > base_;
0071
0072
0073
0074 public:
0075
0076 vector_adaptor() {}
0077
0078 explicit vector_adaptor(Base & c) :
0079 base_(c) {}
0080
0081 protected:
0082
0083 typedef vector_adaptor vector_adaptor_;
0084
0085
0086
0087 public:
0088
0089 BOOST_DEDUCED_TYPENAME base_::size_type capacity() const
0090 {
0091 return this->base().capacity();
0092 }
0093
0094 void reserve(BOOST_DEDUCED_TYPENAME base_::size_type m)
0095 {
0096 this->base().resize(m);
0097 }
0098
0099 void resize(BOOST_DEDUCED_TYPENAME base_::size_type n,
0100 BOOST_DEDUCED_TYPENAME ::boost::call_traits<
0101 BOOST_DEDUCED_TYPENAME base_::value_type >::param_type x =
0102 BOOST_DEDUCED_TYPENAME base_::value_type())
0103 {
0104 this->base().resize(n,
0105 this->template functor<BOOST_DEDUCED_TYPENAME base_::value_to_base>()(x)
0106 );
0107 }
0108
0109 BOOST_DEDUCED_TYPENAME base_::const_reference
0110 operator[](BOOST_DEDUCED_TYPENAME base_::size_type n) const
0111 {
0112 return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
0113 this->base().operator[](n)
0114 );
0115 }
0116
0117 BOOST_DEDUCED_TYPENAME base_::const_reference
0118 at(BOOST_DEDUCED_TYPENAME base_::size_type n) const
0119 {
0120 return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
0121 this->base().at(n)
0122 );
0123 }
0124
0125 BOOST_DEDUCED_TYPENAME base_::reference
0126 operator[](BOOST_DEDUCED_TYPENAME base_::size_type n)
0127 {
0128 return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
0129 this->base().operator[](n)
0130 );
0131 }
0132
0133 BOOST_DEDUCED_TYPENAME base_::reference
0134 at(BOOST_DEDUCED_TYPENAME base_::size_type n)
0135 {
0136 return this->template functor<BOOST_DEDUCED_TYPENAME base_::value_from_base>()(
0137 this->base().at(n)
0138 );
0139 }
0140 };
0141
0142
0143 }
0144 }
0145 }
0146
0147
0148 #endif
0149
0150