Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:44:10

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 views/list_map_view.hpp
0010 /// \brief View of a side of a bimap.
0011 
0012 #ifndef BOOST_BIMAP_VIEWS_LIST_MAP_VIEW_HPP
0013 #define BOOST_BIMAP_VIEWS_LIST_MAP_VIEW_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/list_map_adaptor.hpp>
0022 #include <boost/bimap/relation/support/pair_by.hpp>
0023 #include <boost/bimap/support/iterator_type_by.hpp>
0024 #include <boost/bimap/detail/map_view_base.hpp>
0025 #include <boost/bimap/relation/support/data_extractor.hpp>
0026 #include <boost/bimap/relation/detail/to_mutable_relation_functor.hpp>
0027 
0028 namespace boost {
0029 namespace bimaps {
0030 namespace views {
0031 
0032 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
0033 
0034 template< class Tag, class BimapType >
0035 struct list_map_view_base
0036 {
0037     typedef ::boost::bimaps::container_adaptor::list_map_adaptor
0038     <
0039         BOOST_DEDUCED_TYPENAME BimapType::core_type::
0040             BOOST_NESTED_TEMPLATE index<Tag>::type,
0041         ::boost::bimaps::detail::              map_view_iterator<Tag,BimapType>,
0042         ::boost::bimaps::detail::        const_map_view_iterator<Tag,BimapType>,
0043         ::boost::bimaps::detail::      reverse_map_view_iterator<Tag,BimapType>,
0044         ::boost::bimaps::detail::const_reverse_map_view_iterator<Tag,BimapType>,
0045         ::boost::bimaps::container_adaptor::support::iterator_facade_to_base
0046         <
0047             ::boost::bimaps::detail::      map_view_iterator<Tag,BimapType>,
0048             ::boost::bimaps::detail::const_map_view_iterator<Tag,BimapType>
0049             
0050         >,
0051         ::boost::mpl::na,
0052         ::boost::mpl::na,
0053         ::boost::bimaps::relation::detail::
0054             pair_to_relation_functor<Tag, BOOST_DEDUCED_TYPENAME BimapType::relation >,
0055         ::boost::bimaps::relation::support::
0056             get_pair_functor<Tag, BOOST_DEDUCED_TYPENAME BimapType::relation >,
0057 
0058         BOOST_DEDUCED_TYPENAME ::boost::bimaps::relation::support::data_extractor
0059         <
0060             Tag,
0061             BOOST_DEDUCED_TYPENAME BimapType::relation
0062             
0063         >::type
0064 
0065     > type;
0066 };
0067 
0068 #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
0069 
0070 /// \brief View of a side of a bimap.
0071 /**
0072 
0073 This class uses container_adaptor and iterator_adaptor to wrapped a index of the
0074 multi_index bimap core.
0075 
0076 See also const_list_map_view.
0077                                                                                     **/
0078 template< class Tag, class BimapType >
0079 class list_map_view
0080 :
0081     public list_map_view_base<Tag,BimapType>::type,
0082     public ::boost::bimaps::detail::
0083             map_view_base< list_map_view<Tag,BimapType>,Tag,BimapType >
0084 
0085 {
0086     typedef BOOST_DEDUCED_TYPENAME list_map_view_base<Tag,BimapType>::type base_;
0087 
0088     BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(list_map_view,Tag,BimapType)
0089 
0090     public:
0091 
0092     typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
0093 
0094     list_map_view(BOOST_DEDUCED_TYPENAME base_::base_type & c) :
0095         base_(c) {}
0096 
0097     list_map_view & operator=(const list_map_view & v)
0098     {
0099         this->base() = v.base(); 
0100         return *this;
0101     }
0102 
0103     BOOST_BIMAP_VIEW_ASSIGN_IMPLEMENTATION(base_)
0104 
0105     BOOST_BIMAP_VIEW_FRONT_BACK_IMPLEMENTATION(base_)
0106 
0107     // Rearrange Operations
0108 
0109     void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
0110                   BOOST_DEDUCED_TYPENAME base_::iterator i)
0111     {
0112         this->base().relocate(
0113             this->template functor<
0114                 BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
0115             this->template functor<
0116                 BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(i)
0117         );
0118     }
0119 
0120     void relocate(BOOST_DEDUCED_TYPENAME base_::iterator position,
0121                   BOOST_DEDUCED_TYPENAME base_::iterator first,
0122                   BOOST_DEDUCED_TYPENAME base_::iterator last)
0123     {
0124         this->base().relocate(
0125             this->template functor<
0126                 BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(position),
0127             this->template functor<
0128                 BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(first),
0129             this->template functor<
0130                 BOOST_DEDUCED_TYPENAME base_::iterator_to_base>()(last)
0131         );
0132     }
0133 };
0134 
0135 
0136 } // namespace views
0137 
0138 /*===========================================================================*/
0139 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME)            \
0140 typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME                             \
0141     BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
0142 /*===========================================================================*/
0143 
0144 /*===========================================================================*/
0145 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE)               \
0146     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator)        \
0147     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator)  \
0148 /*===========================================================================*/
0149 
0150 namespace detail {
0151 
0152 template< class Tag, class BimapType >
0153 struct left_map_view_extra_typedefs< ::boost::bimaps::views::list_map_view<Tag,BimapType> >
0154 {
0155     private: typedef ::boost::bimaps::views::list_map_view<Tag,BimapType> map_view_;
0156     public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
0157 };
0158 
0159 template< class Tag, class BimapType >
0160 struct right_map_view_extra_typedefs< ::boost::bimaps::views::list_map_view<Tag,BimapType> >
0161 {
0162     private: typedef ::boost::bimaps::views::list_map_view<Tag,BimapType> map_view_;
0163     public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
0164 };
0165 
0166 } // namespace detail
0167 
0168 /*===========================================================================*/
0169 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
0170 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
0171 /*===========================================================================*/
0172 
0173 } // namespace bimaps
0174 } // namespace boost
0175 
0176 #endif // BOOST_BIMAP_VIEWS_LIST_MAP_VIEW_HPP
0177