]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/bimap/include/boost/bimap/multiset_of.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / bimap / include / boost / bimap / multiset_of.hpp
CommitLineData
7c673cae
FG
1// Boost.Bimap
2//
3// Copyright (c) 2006-2007 Matias Capeletto
4//
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)
8
9/// \file multiset_of.hpp
10/// \brief Include support for multiset constrains for the bimap container
11
12#ifndef BOOST_BIMAP_MULTISET_OF_HPP
13#define BOOST_BIMAP_MULTISET_OF_HPP
14
15#if defined(_MSC_VER)
16#pragma once
17#endif
18
19#include <boost/config.hpp>
20
21#include <boost/bimap/detail/user_interface_config.hpp>
22
23#include <functional>
24#include <boost/mpl/bool.hpp>
25
26#include <boost/concept_check.hpp>
27
28#include <boost/bimap/detail/concept_tags.hpp>
29
30#include <boost/bimap/tags/support/value_type_of.hpp>
31
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>
35
36#include <boost/multi_index/ordered_index.hpp>
37
38#include <boost/bimap/views/multimap_view.hpp>
39#include <boost/bimap/views/multiset_view.hpp>
40
41namespace boost {
42namespace bimaps {
43
44/// \brief Set Type Specification
45/**
46This struct is used to specify a multiset specification.
47It is not a container, it is just a metaprogramming facility to
48express the type of a set. Generally, this specification will
49be used in other place to create a container.
50It has the same syntax that an std::set instantiation, except
51that the allocator cannot be specified. The rationale behind
52this difference is that the allocator is not part of the set
53type specification, rather it is a container configuration
54parameter.
55The first parameter is the type of the objects in the multiset,
56and the second one is a Functor that compares them.
57Bimap binding metafunctions can be used with this class in
58the following way:
59
60\code
61using namespace support;
62
63BOOST_STATIC_ASSERT( is_set_type_of< multiset_of<Type> >::value )
64
65BOOST_STATIC_ASSERT
66(
67 is_same
68 <
69 compute_index_type
70 <
71 multiset_of<Type,KeyCompare>,
72 KeyExtractor,
73 Tag
74
75 >::type
76 ,
77 ordered_nonunique< tag<Tag>, KeyExtractor, KeyCompare >
78
79 >::value
80)
81
82typedef bimap
83<
84 multiset_of<Type>, RightKeyType
85
86> bimap_with_left_type_as_multiset;
87
88BOOST_STATIC_ASSERT
89(
90 is_same
91 <
92 compute_map_view_type
93 <
94 member_at::left,
95 bimap_with_left_type_as_multiset
96
97 >::type,
98 multimap_view< member_at::left, bimap_with_left_type_as_multiset >
99
100 >::value
101)
102
103\endcode
104
105See also multiset_of_relation.
106 **/
107
108template
109<
110 class KeyType,
111 class KeyCompare = std::less< BOOST_DEDUCED_TYPENAME
112 ::boost::bimaps::tags::support::value_type_of<KeyType>::type >
113>
114struct multiset_of : public ::boost::bimaps::detail::set_type_of_tag
115{
116 /// User type, can be tagged
117 typedef KeyType user_type;
118
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;
122
123 /// Functor that compare two keys
124 typedef KeyCompare key_compare;
125
126 struct lazy_concept_checked
127 {
128 BOOST_CLASS_REQUIRE ( value_type,
129 boost, AssignableConcept );
130
131 BOOST_CLASS_REQUIRE4( key_compare, bool, value_type, value_type,
132 boost, BinaryFunctionConcept );
133
134 typedef multiset_of type;
135 };
136
137 BOOST_BIMAP_GENERATE_INDEX_BINDER_1CP(
138
139 // binds to
140 multi_index::ordered_non_unique,
141
142 // with
143 key_compare
144 )
145
146 BOOST_BIMAP_GENERATE_MAP_VIEW_BINDER(
147
148 // binds to
149 views::multimap_view
150 )
151
152 BOOST_BIMAP_GENERATE_SET_VIEW_BINDER(
153
154 // binds to
155 views::multiset_view
156 )
157
158 typedef mpl::bool_<false> mutable_key;
159};
160
161
162/// \brief Set Of Relation Specification
163/**
164This struct is similar to multiset_of but it is bind logically to a
165relation. It is used in the bimap instantiation to specify the
166desired type of the main view. This struct implements internally
167a metafunction named bind_to that manages the quite complicated
168task of finding the right type of the set for the relation.
169
170\code
171template<class Relation>
172struct bind_to
173{
174 typedef -unspecified- type;
175};
176\endcode
177
178See also multiset_of, is_set_type_of_relation.
179 **/
180
181template< class KeyCompare = std::less< _relation > >
182struct multiset_of_relation : public ::boost::bimaps::detail::set_type_of_relation_tag
183{
184 /// Functor that compare two keys
185 typedef KeyCompare key_compare;
186
187
188 BOOST_BIMAP_GENERATE_RELATION_BINDER_1CP(
189
190 // binds to
191 multiset_of,
192
193 // with
194 key_compare
195 )
196
197 typedef mpl::bool_<false> left_mutable_key;
198 typedef mpl::bool_<false> right_mutable_key;
199};
200
201} // namespace bimaps
202} // namespace boost
203
204
205#endif // BOOST_BIMAP_MULTISET_OF_HPP