Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:29:40

0001 // Boost.Bimap
0002 //
0003 // Copyright (c) 2006-2007 Matias Capeletto
0004 //
0005 // Distributed under the Boost Software License, Version 1.0.
0006 // (See accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 /// \file vector_of.hpp
0010 /// \brief Include support for vector constrains for the bimap container
0011 
0012 #ifndef BOOST_BIMAP_VECTOR_OF_HPP
0013 #define BOOST_BIMAP_VECTOR_OF_HPP
0014 
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018 
0019 #include <boost/config.hpp>
0020 
0021 #include <boost/bimap/detail/user_interface_config.hpp>
0022 
0023 #include <boost/mpl/bool.hpp>
0024 
0025 #include <boost/concept_check.hpp>
0026 
0027 #include <boost/bimap/detail/concept_tags.hpp>
0028 
0029 #include <boost/bimap/tags/support/value_type_of.hpp>
0030 
0031 #include <boost/bimap/detail/generate_index_binder.hpp>
0032 #include <boost/bimap/detail/generate_view_binder.hpp>
0033 #include <boost/bimap/detail/generate_relation_binder.hpp>
0034 
0035 #include <boost/multi_index/random_access_index.hpp>
0036 
0037 #include <boost/bimap/views/vector_map_view.hpp>
0038 #include <boost/bimap/views/vector_set_view.hpp>
0039 
0040 namespace boost {
0041 namespace bimaps {
0042 
0043 
0044 /// \brief Set Type Specification
0045 /**
0046 This struct is used to specify a set specification.
0047 It is not a container, it is just a metaprogramming facility to
0048 express the type of a set. Generally, this specification will
0049 be used in other place to create a container.
0050 It has the same syntax that an std::vector instantiation, except
0051 that the allocator cannot be specified. The rationale behind
0052 this difference is that the allocator is not part of the set
0053 type specification, rather it is a container configuration
0054 parameter.
0055 The first parameter is the type of the objects in the set, and
0056 the second one is a Functor that compares them.
0057 Bimap binding metafunctions can be used with this class in
0058 the following way:
0059 
0060 \code
0061 using namespace support;
0062 
0063 BOOST_STATIC_ASSERT( is_set_type_of< vector_of<Type> >::value )
0064 
0065 BOOST_STATIC_ASSERT
0066 (
0067      is_same
0068      <
0069         vector_of<Type>::index_bind
0070         <
0071             KeyExtractor,
0072             Tag
0073 
0074         >::type,
0075 
0076         random_access< tag<Tag>, KeyExtractor >
0077 
0078     >::value
0079 )
0080 
0081 typedef bimap
0082 <
0083     vector_of<Type>, RightKeyType
0084 
0085 > bimap_with_left_type_as_vector;
0086 
0087 BOOST_STATIC_ASSERT
0088 (
0089     is_same
0090     <
0091         vector_of<Type>::map_view_bind
0092         <
0093             member_at::left,
0094             bimap_with_left_type_as_vector
0095 
0096         >::type,
0097 
0098         vector_map_view< member_at::left, bimap_with_left_type_as_vector >
0099 
0100     >::value
0101 )
0102 
0103 \endcode
0104 
0105 See also vector_of_relation.
0106                                                                         **/
0107 
0108 template< class Type >
0109 struct vector_of : public ::boost::bimaps::detail::set_type_of_tag
0110 {
0111     /// User type, can be tagged
0112     typedef Type user_type;
0113 
0114     /// Type of the object that will be stored in the vector
0115     typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support::
0116         value_type_of<user_type>::type value_type;
0117 
0118 
0119     struct lazy_concept_checked
0120     {
0121         BOOST_CLASS_REQUIRE ( value_type,
0122                               boost, AssignableConcept );
0123 
0124         typedef vector_of type;
0125     };
0126 
0127     BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP_NO_EXTRACTOR(
0128 
0129         // binds to
0130         multi_index::random_access
0131     )
0132 
0133     BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
0134 
0135         // binds to
0136         views::vector_map_view
0137     )
0138 
0139     BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
0140 
0141         // binds to
0142         views::vector_set_view
0143     )
0144 
0145     typedef mpl::bool_<true> mutable_key;
0146 };
0147 
0148 
0149 /// \brief Set Of Relation Specification
0150 /**
0151 This struct is similar to vector_of but it is bind logically to a
0152 relation. It is used in the bimap instantiation to specify the
0153 desired type of the main view. This struct implements internally
0154 a metafunction named bind_to that manages the quite complicated
0155 task of finding the right type of the set for the relation.
0156 
0157 \code
0158 template<class Relation>
0159 struct bind_to
0160 {
0161     typedef -unspecified- type;
0162 };
0163 \endcode
0164 
0165 See also vector_of, is_set_type_of_relation.
0166                                                                 **/
0167 
0168 struct vector_of_relation : public ::boost::bimaps::detail::set_type_of_relation_tag
0169 {
0170     BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP(
0171 
0172         // binds to
0173         vector_of
0174     )
0175 
0176     typedef mpl::bool_<true>  left_mutable_key;
0177     typedef mpl::bool_<true> right_mutable_key;
0178 };
0179 
0180 
0181 } // namespace bimaps
0182 } // namespace boost
0183 
0184 
0185 #endif // BOOST_BIMAP_VECTOR_OF_HPP
0186