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 list_of.hpp
0010 /// \brief Include support for list constrains for the bimap container
0011 
0012 #ifndef BOOST_BIMAP_LIST_OF_HPP
0013 #define BOOST_BIMAP_LIST_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/sequenced_index.hpp>
0036 
0037 #include <boost/bimap/views/list_map_view.hpp>
0038 #include <boost/bimap/views/list_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::list 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 
0056 \code
0057 using namespace support;
0058 
0059 BOOST_STATIC_ASSERT( is_set_type_of< list_of<Type> >::value )
0060 
0061 BOOST_STATIC_ASSERT
0062 (
0063      is_same
0064      <
0065         list_of<Type>::index_bind
0066         <
0067             KeyExtractor,
0068             Tag
0069 
0070         >::type,
0071 
0072         sequenced< tag<Tag>, KeyExtractor >
0073 
0074     >::value
0075 )
0076 
0077 typedef bimap
0078 <
0079     list_of<Type>, RightKeyType
0080 
0081 > bimap_with_left_type_as_list;
0082 
0083 BOOST_STATIC_ASSERT
0084 (
0085     is_same
0086     <
0087         list_of<Type>::map_view_bind
0088         <
0089             member_at::left,
0090             bimap_with_left_type_as_list
0091 
0092         >::type,
0093         list_map_view< member_at::left, bimap_with_left_type_as_list >
0094 
0095     >::value
0096 )
0097 
0098 \endcode
0099 
0100 See also list_of_relation.
0101                                                                         **/
0102 
0103 template< class Type >
0104 struct list_of : public ::boost::bimaps::detail::set_type_of_tag
0105 {
0106     /// User type, can be tagged
0107     typedef Type user_type;
0108 
0109     /// Type of the object that will be stored in the list
0110     typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support::
0111         value_type_of<user_type>::type value_type;
0112 
0113 
0114     struct lazy_concept_checked
0115     {
0116         BOOST_CLASS_REQUIRE ( value_type,
0117                               boost, AssignableConcept );
0118 
0119         typedef list_of type;
0120     };
0121 
0122     BOOST_BIMAP_GENERATE_INDEX_BINDER_0CP_NO_EXTRACTOR(
0123 
0124         // binds to
0125         multi_index::sequenced
0126     )
0127 
0128     BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
0129 
0130         // binds to
0131         views::list_map_view
0132     )
0133 
0134     BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
0135 
0136         // binds to
0137         views::list_set_view
0138     )
0139 
0140     typedef mpl::bool_<true> mutable_key;
0141 };
0142 
0143 
0144 /// \brief List Of Relation Specification
0145 /**
0146 This struct is similar to list_of but it is bind logically to a
0147 relation. It is used in the bimap instantiation to specify the
0148 desired type of the main view. This struct implements internally
0149 a metafunction named bind_to that manages the quite complicated
0150 task of finding the right type of the set for the relation.
0151 
0152 \code
0153 template<class Relation>
0154 struct bind_to
0155 {
0156     typedef -unspecified- type;
0157 };
0158 \endcode
0159 
0160 See also list_of, is_set_type_of_relation.
0161                                                                 **/
0162 
0163 struct list_of_relation : public ::boost::bimaps::detail::set_type_of_relation_tag
0164 {
0165     BOOST_BIMAP_GENERATE_RELATION_BINDER_0CP(
0166 
0167         // binds to
0168         list_of
0169     )
0170 
0171     typedef mpl::bool_<true>  left_mutable_key;
0172     typedef mpl::bool_<true> right_mutable_key;
0173 };
0174 
0175 
0176 } // namespace bimaps
0177 } // namespace boost
0178 
0179 
0180 #endif // BOOST_BIMAP_LIST_OF_HPP
0181