3 // Copyright (c) 2006-2007 Matias Capeletto
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 /// \file views/unordered_multimap_view.hpp
10 /// \brief View of a side of a bimap that is signature compatible with tr1::unordered_multimap.
12 #ifndef BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
13 #define BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
19 #include <boost/config.hpp>
23 #include <boost/bimap/container_adaptor/unordered_multimap_adaptor.hpp>
24 #include <boost/bimap/detail/non_unique_views_helper.hpp>
25 #include <boost/bimap/support/iterator_type_by.hpp>
26 #include <boost/bimap/detail/map_view_base.hpp>
32 /// \brief View of a side of a bimap that is signature compatible with tr1::unordered_multimap.
35 This class uses container_adaptor and iterator_adaptor to wrapped a index of the
36 multi_index bimap core so it can be used as a tr1::unordered_multimap.
38 See also const_unordered_multimap_view.
41 template< class Tag
, class BimapType
>
42 class unordered_multimap_view
44 public BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
45 unordered_multimap_adaptor
,
47 local_iterator_type_by
,const_local_iterator_type_by
50 public ::boost::bimaps::detail::map_view_base
<
51 unordered_multimap_view
<Tag
,BimapType
>,Tag
,BimapType
>
54 typedef BOOST_BIMAP_MAP_VIEW_CONTAINER_ADAPTOR(
55 unordered_multimap_adaptor
,
57 local_iterator_type_by
,const_local_iterator_type_by
61 BOOST_BIMAP_MAP_VIEW_BASE_FRIEND(unordered_multimap_view
,Tag
,BimapType
)
66 BOOST_DEDUCED_TYPENAME
base_::iterator
,
67 BOOST_DEDUCED_TYPENAME
base_::iterator
71 BOOST_DEDUCED_TYPENAME
base_::const_iterator
,
72 BOOST_DEDUCED_TYPENAME
base_::const_iterator
75 typedef BOOST_DEDUCED_TYPENAME
base_::value_type::info_type info_type
;
77 unordered_multimap_view(BOOST_DEDUCED_TYPENAME
base_::base_type
& c
)
80 BOOST_BIMAP_NON_UNIQUE_VIEW_INSERT_FUNCTIONS
82 unordered_multimap_view
& operator=(const unordered_multimap_view
& v
)
84 this->base() = v
.base();
92 /*===========================================================================*/
93 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,TYPENAME) \
94 typedef BOOST_DEDUCED_TYPENAME MAP_VIEW::TYPENAME \
95 BOOST_PP_CAT(SIDE,BOOST_PP_CAT(_,TYPENAME));
96 /*===========================================================================*/
98 /*===========================================================================*/
99 #define BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(MAP_VIEW,SIDE) \
100 BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,local_iterator) \
101 BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_local_iterator) \
102 BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,range_type) \
103 BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,const_range_type) \
104 BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,hasher) \
105 BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF(MAP_VIEW,SIDE,key_equal)
106 /*===========================================================================*/
110 template< class Tag
, class BimapType
>
111 struct left_map_view_extra_typedefs
< ::boost::bimaps::views::unordered_multimap_view
<Tag
,BimapType
> >
113 private: typedef ::boost::bimaps::views::unordered_multimap_view
<Tag
,BimapType
> map_view_
;
114 public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_
,left
)
117 template< class Tag
, class BimapType
>
118 struct right_map_view_extra_typedefs
< ::boost::bimaps::views::unordered_multimap_view
<Tag
,BimapType
> >
120 private: typedef ::boost::bimaps::views::unordered_multimap_view
<Tag
,BimapType
> map_view_
;
121 public : BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY(map_view_
,right
)
124 } // namespace detail
126 /*===========================================================================*/
127 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEF
128 #undef BOOST_BIMAP_MAP_VIEW_EXTRA_TYPEDEFS_BODY
129 /*===========================================================================*/
131 } // namespace bimaps
134 #endif // BOOST_BIMAP_VIEWS_UNOREDERED_MULTIMAP_VIEW_HPP