Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:04:01

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/multimap_view.hpp
0010 /// \brief View of a side of a bimap that is signature compatible with std::multimap.
0011 
0012 #ifndef BOOST_BIMAP_VIEWS_MULTIMAP_VIEW_HPP
0013 #define BOOST_BIMAP_VIEWS_MULTIMAP_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/multimap_adaptor.hpp>
0022 #include <boost/bimap/detail/non_unique_views_helper.hpp>
0023 #include <boost/bimap/support/iterator_type_by.hpp>
0024 #include <boost/bimap/detail/map_view_base.hpp>
0025 
0026 namespace boost {
0027 namespace bimaps {
0028 namespace views {
0029 
0030 /// \brief View of a side of a bimap that is signature compatible with std::multimap.
0031 /**
0032 
0033 This class uses container_adaptor and iterator_adaptor to wrapped a index of the
0034 multi_index bimap core so it can be used as a std::multimap.
0035 
0036 See also const_multimap_view.
0037                                                                                     **/
0038 
0039 template< class Tag, class BimapType >
0040 class multimap_view
0041 :
0042     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
0043         multimap_adaptor,
0044         Tag,BimapType,
0045         reverse_map_view_iterator,const_reverse_map_view_iterator
0046     ),
0047     public ::boost::bimaps::detail::
0048                 map_view_base< multimap_view<Tag,BimapType>,Tag,BimapType >
0049 
0050 {
0051     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
0052         multimap_adaptor,
0053         Tag,BimapType,
0054         reverse_map_view_iterator,const_reverse_map_view_iterator
0055 
0056     ) base_;
0057 
0058     BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(multimap_view,Tag,BimapType)
0059 
0060     public:
0061 
0062     typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
0063 
0064     multimap_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
0065         : base_(c) {}
0066 
0067     BOOST_BIMAP_MAP_VIEW_RANGE_IMPLEMENTATION(base_)
0068 
0069     multimap_view & operator=(const multimap_view & v) 
0070     {
0071         this->base() = v.base();
0072         return *this;
0073     }
0074 
0075     BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
0076 };
0077 
0078 
0079 } // namespace views
0080 
0081 /*===========================================================================*/
0082 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME)            \
0083 typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME                             \
0084     BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
0085 /*===========================================================================*/
0086 
0087 /*===========================================================================*/
0088 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE)               \
0089     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,reverse_iterator)        \
0090     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_reverse_iterator)  \
0091     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type)              \
0092     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type)        \
0093     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_compare)
0094 /*===========================================================================*/
0095 
0096 namespace detail {
0097 
0098 template< class Tag, class BimapType >
0099 struct left_map_view_extra_typedefs< ::boost::bimaps::views::multimap_view<Tag,BimapType> >
0100 {
0101     private: typedef ::boost::bimaps::views::multimap_view<Tag,BimapType> map_view_;
0102     public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
0103 };
0104 
0105 template< class Tag, class BimapType >
0106 struct right_map_view_extra_typedefs< ::boost::bimaps::views::multimap_view<Tag,BimapType> >
0107 {
0108     private: typedef ::boost::bimaps::views::multimap_view<Tag,BimapType> map_view_;
0109     public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
0110 };
0111 
0112 } // namespace detail
0113 
0114 /*===========================================================================*/
0115 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
0116 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
0117 /*===========================================================================*/
0118 
0119 } // namespace bimaps
0120 } // namespace boost
0121 
0122 #endif // BOOST_BIMAP_VIEWS_MAP_VIEW_HPP
0123