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 multiset_of.hpp
10 /// \brief Include support for multiset constrains for the bimap container
12 #ifndef BOOST_BIMAP_MULTISET_OF_HPP
13 #define BOOST_BIMAP_MULTISET_OF_HPP
15 #if defined(_MSC_VER) && (_MSC_VER>=1200)
19 #include <boost/config.hpp>
21 #include <boost/bimap/detail/user_interface_config.hpp>
24 #include <boost/mpl/bool.hpp>
26 #include <boost/concept_check.hpp>
28 #include <boost/bimap/detail/concept_tags.hpp>
30 #include <boost/bimap/tags/support/value_type_of.hpp>
32 #include <boost/bimap/detail/generate_index_binder.hpp>
33 #include <boost/bimap/detail/generate_view_binder.hpp>
34 #include <boost/bimap/detail/generate_relation_binder.hpp>
36 #include <boost/multi_index/ordered_index.hpp>
38 #include <boost/bimap/views/multimap_view.hpp>
39 #include <boost/bimap/views/multiset_view.hpp>
44 /// \brief Set Type Specification
46 This struct is used to specify a multiset specification.
47 It is not a container, it is just a metaprogramming facility to
48 express the type of a set. Generally, this specification will
49 be used in other place to create a container.
50 It has the same syntax that an std::set instantiation, except
51 that the allocator cannot be specified. The rationale behind
52 this difference is that the allocator is not part of the set
53 type specification, rather it is a container configuration
55 The first parameter is the type of the objects in the multiset,
56 and the second one is a Functor that compares them.
57 Bimap binding metafunctions can be used with this class in
61 using namespace support;
63 BOOST_STATIC_ASSERT( is_set_type_of< multiset_of<Type> >::value )
71 multiset_of<Type,KeyCompare>,
77 ordered_nonunique< tag<Tag>, KeyExtractor, KeyCompare >
84 multiset_of<Type>, RightKeyType
86 > bimap_with_left_type_as_multiset;
95 bimap_with_left_type_as_multiset
98 multimap_view< member_at::left, bimap_with_left_type_as_multiset >
105 See also multiset_of_relation.
111 class KeyCompare
= std::less
< BOOST_DEDUCED_TYPENAME
112 ::boost::bimaps::tags::support::value_type_of
<KeyType
>::type
>
114 struct multiset_of
: public ::boost::bimaps::detail::set_type_of_tag
116 /// User type, can be tagged
117 typedef KeyType user_type
;
119 /// Type of the object that will be stored in the multiset
120 typedef BOOST_DEDUCED_TYPENAME ::boost::bimaps::tags::support::
121 value_type_of
<user_type
>::type value_type
;
123 /// Functor that compare two keys
124 typedef KeyCompare key_compare
;
126 struct lazy_concept_checked
128 BOOST_CLASS_REQUIRE ( value_type
,
129 boost
, AssignableConcept
);
131 BOOST_CLASS_REQUIRE4( key_compare
, bool, value_type
, value_type
,
132 boost
, BinaryFunctionConcept
);
134 typedef multiset_of type
;
137 BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP(
140 multi_index::ordered_non_unique
,
146 BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
152 BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
158 typedef mpl::bool_
<false> mutable_key
;
162 /// \brief Set Of Relation Specification
164 This struct is similar to multiset_of but it is bind logically to a
165 relation. It is used in the bimap instantiation to specify the
166 desired type of the main view. This struct implements internally
167 a metafunction named bind_to that manages the quite complicated
168 task of finding the right type of the set for the relation.
171 template<class Relation>
174 typedef -unspecified- type;
178 See also multiset_of, is_set_type_of_relation.
181 template< class KeyCompare
= std::less
< _relation
> >
182 struct multiset_of_relation
: public ::boost::bimaps::detail::set_type_of_relation_tag
184 /// Functor that compare two keys
185 typedef KeyCompare key_compare
;
188 BOOST_BIMAP_GENERATE_RELATION_BINDER_1CP(
197 typedef mpl::bool_
<false> left_mutable_key
;
198 typedef mpl::bool_
<false> right_mutable_key
;
201 } // namespace bimaps
205 #endif // BOOST_BIMAP_MULTISET_OF_HPP