annotate DEPENDENCIES/generic/include/boost/bimap/multiset_of.hpp @ 133:4acb5d8d80b6 tip

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