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/unordered_multimap_view.hpp
0010 /// \brief View of a side of a bimap that is signature compatible with tr1::unordered_multimap.
0011 
0012 #ifndef BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
0013 #define BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
0014 
0015 #if defined(_MSC_VER)
0016 #pragma once
0017 #endif
0018 
0019 #include <boost/config.hpp>
0020 
0021 #include <utility>
0022 
0023 #include <boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp>
0024 #include <boost/bimap/detail/non_unique_views_helper.hpp>
0025 #include <boost/bimap/support/iterator_type_by.hpp>
0026 #include <boost/bimap/detail/map_view_base.hpp>
0027 
0028 namespace boost {
0029 namespace bimaps {
0030 namespace views {
0031 
0032 /// \brief View of a side of a bimap that is signature compatible with tr1::unordered_multimap.
0033 /**
0034 
0035 This class uses container_adaptor and iterator_adaptor to wrapped a index of the
0036 multi_index bimap core so it can be used as a tr1::unordered_multimap.
0037 
0038 See also const_unordered_multimap_view.
0039                                                                              **/
0040 
0041 template< class Tag, class BimapType >
0042 class unordered_multimap_view
0043 :
0044     public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
0045         unordered_multimap_adaptor,
0046         Tag,BimapType,
0047         local_map_view_iterator,const_local_map_view_iterator
0048     ),
0049 
0050     public ::boost::bimaps::detail::map_view_base<
0051                 unordered_multimap_view<Tag,BimapType>,Tag,BimapType >
0052 
0053 {
0054     typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
0055         unordered_multimap_adaptor,
0056         Tag,BimapType,
0057         local_map_view_iterator,const_local_map_view_iterator
0058 
0059     ) base_;
0060 
0061     BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(unordered_multimap_view,Tag,BimapType)
0062 
0063     public:
0064 
0065     typedef std::pair<
0066         BOOST_DEDUCED_TYPENAME base_::iterator,
0067         BOOST_DEDUCED_TYPENAME base_::iterator
0068     > range_type;
0069 
0070     typedef std::pair<
0071         BOOST_DEDUCED_TYPENAME base_::const_iterator,
0072         BOOST_DEDUCED_TYPENAME base_::const_iterator
0073     > const_range_type;
0074 
0075     typedef BOOST_DEDUCED_TYPENAME base_::value_type::info_type info_type;
0076 
0077     unordered_multimap_view(BOOST_DEDUCED_TYPENAME base_::base_type & c)
0078         : base_(c) {}
0079 
0080     BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
0081 
0082     unordered_multimap_view & operator=(const unordered_multimap_view & v) 
0083     {
0084         this->base() = v.base();
0085         return *this;
0086     }
0087 };
0088 
0089 
0090 } // namespace views
0091 
0092 /*===========================================================================*/
0093 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME)            \
0094 typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME                             \
0095     BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
0096 /*===========================================================================*/
0097 
0098 /*===========================================================================*/
0099 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE)               \
0100     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,local_iterator)          \
0101     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_local_iterator)    \
0102     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type)              \
0103     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type)        \
0104     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,hasher)                  \
0105     BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_equal)
0106 /*===========================================================================*/
0107 
0108 namespace detail {
0109 
0110 template< class Tag, class BimapType >
0111 struct left_map_view_extra_typedefs< ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> >
0112 {
0113     private: typedef ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> map_view_;
0114     public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,left)
0115 };
0116 
0117 template< class Tag, class BimapType >
0118 struct right_map_view_extra_typedefs< ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> >
0119 {
0120     private: typedef ::boost::bimaps::views::unordered_multimap_view<Tag,BimapType> map_view_;
0121     public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_,right)
0122 };
0123 
0124 } // namespace detail
0125 
0126 /*===========================================================================*/
0127 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
0128 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
0129 /*===========================================================================*/
0130 
0131 } // namespace bimaps
0132 } // namespace boost
0133 
0134 #endif // BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
0135 
0136