annotate DEPENDENCIES/generic/include/boost/bimap/detail/manage_additional_parameters.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 detail/manage_additional_parameters.hpp
Chris@16 10 /// \brief Utility class to extract the additional parameters from the template parameters.
Chris@16 11
Chris@16 12 #ifndef BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
Chris@16 13 #define BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_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 <memory>
Chris@16 22
Chris@16 23 // Boost.MPL
Chris@16 24 #include <boost/mpl/bool.hpp>
Chris@16 25 #include <boost/mpl/if.hpp>
Chris@16 26 #include <boost/mpl/aux_/na.hpp>
Chris@16 27 #include <boost/type_traits/is_same.hpp>
Chris@16 28
Chris@16 29 #include <boost/bimap/detail/is_set_type_of.hpp>
Chris@16 30
Chris@16 31 namespace boost {
Chris@16 32 namespace bimaps {
Chris@16 33
Chris@16 34 template< class Type >
Chris@16 35 struct with_info
Chris@16 36 {
Chris@16 37 typedef Type value_type;
Chris@16 38 };
Chris@16 39
Chris@16 40 namespace detail {
Chris@16 41
Chris@16 42 /// \brief Metafunction to check if a given type is a data_hook specification.
Chris@16 43
Chris@16 44 template< class Type >
Chris@16 45 struct is_with_info : ::boost::mpl::false_ {};
Chris@16 46
Chris@16 47 template< class ValueType >
Chris@16 48 struct is_with_info< with_info<ValueType> > : ::boost::mpl::true_ {};
Chris@16 49
Chris@16 50 /** \struct boost::bimaps::detail::manage_additional_parameters
Chris@16 51 \brief Utility class to extract the additional parameters from the template parameters.
Chris@16 52
Chris@16 53 \code
Chris@16 54 template< class AP1, class AP2, class AP3 >
Chris@16 55 struct manage_additional_parameters
Chris@16 56 {
Chris@16 57 struct parameters
Chris@16 58 {
Chris@16 59 typedef -unspecified- set_type_of_relation;
Chris@16 60 typedef -unspecified- data_hook;
Chris@16 61 typedef -unspecified- allocator;
Chris@16 62 };
Chris@16 63
Chris@16 64 typedef parameters type;
Chris@16 65 };
Chris@16 66 \endcode
Chris@16 67
Chris@16 68 See also bimap, bimap_core.
Chris@16 69 **/
Chris@16 70
Chris@16 71 #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
Chris@16 72
Chris@16 73 template< class AP1, class AP2, class AP3 >
Chris@16 74 struct manage_additional_parameters
Chris@16 75 {
Chris@16 76 // (1) manage_additional_parameters<
Chris@16 77 // not_specified,not_specified,not_specified>
Chris@16 78 //
Chris@16 79 // set_type_of_relation: based on the left key type
Chris@16 80 // info_hook: no additional info
Chris@16 81 // allocator: default allocator
Chris@16 82
Chris@16 83 struct case_NNN
Chris@16 84 {
Chris@16 85 typedef left_based set_type_of_relation;
Chris@16 86 typedef std::allocator<void> allocator;
Chris@16 87 typedef ::boost::mpl::na additional_info;
Chris@16 88 };
Chris@16 89
Chris@16 90 // (2) manage_additional_parameters<Allocator,not_specified,not_specified>
Chris@16 91 //
Chris@16 92 // set_type_of_relation: based on the left key type
Chris@16 93 // info_hook: no additional info
Chris@16 94 // allocator: Allocator
Chris@16 95
Chris@16 96 struct case_ANN
Chris@16 97 {
Chris@16 98 typedef left_based set_type_of_relation;
Chris@16 99 typedef AP1 allocator;
Chris@16 100 typedef ::boost::mpl::na additional_info;
Chris@16 101 };
Chris@16 102
Chris@16 103 // (3) manage_additional_parameters<
Chris@16 104 // SetOfRelationType,not_specified,not_specified>
Chris@16 105 //
Chris@16 106 // set_type_of_relation: SetTypeOfRelation
Chris@16 107 // info_hook: no additional info
Chris@16 108 // allocator: default allocator
Chris@16 109
Chris@16 110 struct case_SNN
Chris@16 111 {
Chris@16 112 typedef AP1 set_type_of_relation;
Chris@16 113 typedef std::allocator<void> allocator;
Chris@16 114 typedef ::boost::mpl::na additional_info;
Chris@16 115 };
Chris@16 116
Chris@16 117 // (4) manage_additional_parameters<
Chris@16 118 // SetTypeOfRelation,Allocator,not_specified>
Chris@16 119 //
Chris@16 120 // set_type_of_relation: SetTypeOfRelation
Chris@16 121 // info_hook: no additional info
Chris@16 122 // allocator: Allocator
Chris@16 123
Chris@16 124 struct case_SAN
Chris@16 125 {
Chris@16 126 typedef AP1 set_type_of_relation;
Chris@16 127 typedef AP2 allocator;
Chris@16 128 typedef ::boost::mpl::na additional_info;
Chris@16 129 };
Chris@16 130
Chris@16 131 // (5) manage_additional_parameters<InfoToHook,not_specified,not_specified>
Chris@16 132 //
Chris@16 133 // set_type_of_relation: based on the left key type
Chris@16 134 // info_hook: InfoToHook
Chris@16 135 // allocator: default allocator
Chris@16 136
Chris@16 137 struct case_HNN
Chris@16 138 {
Chris@16 139 typedef left_based set_type_of_relation;
Chris@16 140 typedef std::allocator<void> allocator;
Chris@16 141 typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info;
Chris@16 142 };
Chris@16 143
Chris@16 144 // (6) manage_additional_parameters<
Chris@16 145 // SetTypeOfRelation,InfoToHook,not_specified>
Chris@16 146 //
Chris@16 147 // set_type_of_relation: SetTypeOfRelation
Chris@16 148 // info_hook: InfoToHook
Chris@16 149 // allocator: default allocator
Chris@16 150
Chris@16 151 struct case_SHN
Chris@16 152 {
Chris@16 153 typedef AP1 set_type_of_relation;
Chris@16 154 typedef std::allocator<void> allocator;
Chris@16 155 typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
Chris@16 156 };
Chris@16 157
Chris@16 158 // (7) manage_additional_parameters<
Chris@16 159 // DataToHook,Allocator,not_specified>
Chris@16 160 //
Chris@16 161 // set_type_of_relation: SetTypeOfRelation
Chris@16 162 // info_hook: InfoToHook
Chris@16 163 // allocator: default allocator
Chris@16 164
Chris@16 165 struct case_HAN
Chris@16 166 {
Chris@16 167 typedef left_based set_type_of_relation;
Chris@16 168 typedef AP2 allocator;
Chris@16 169 typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info;
Chris@16 170 };
Chris@16 171
Chris@16 172 // (8) manage_additional_parameters<
Chris@16 173 // SetTypeOfRelation,DataToHook,Allocator>
Chris@16 174 //
Chris@16 175 // set_type_of_relation: SetTypeOfRelation
Chris@16 176 // info_hook: InfoToHook
Chris@16 177 // allocator: Allocator
Chris@16 178
Chris@16 179 struct case_SHA
Chris@16 180 {
Chris@16 181 typedef AP1 set_type_of_relation;
Chris@16 182 typedef AP2 allocator;
Chris@16 183 typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
Chris@16 184 };
Chris@16 185
Chris@16 186 // Some annidated mpl::if_ and we are done!
Chris@16 187
Chris@16 188 typedef BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 189 <
Chris@16 190 ::boost::mpl::is_na<AP1>,
Chris@16 191 case_NNN, // (1)
Chris@16 192 BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 193 <
Chris@16 194 ::boost::mpl::is_na<AP2>,
Chris@16 195 BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 196 <
Chris@16 197 is_set_type_of_relation<AP1>,
Chris@16 198 case_SNN, // (3)
Chris@16 199 BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 200 <
Chris@16 201 is_with_info<AP1>,
Chris@16 202 case_HNN, // (5)
Chris@16 203 case_ANN // (2)
Chris@16 204
Chris@16 205 >::type
Chris@16 206
Chris@16 207 >::type,
Chris@16 208 BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 209 <
Chris@16 210 ::boost::mpl::is_na<AP3>,
Chris@16 211 BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 212 <
Chris@16 213 is_with_info<AP1>,
Chris@16 214 case_HAN, // (7)
Chris@16 215 BOOST_DEDUCED_TYPENAME mpl::if_
Chris@16 216 <
Chris@16 217 is_with_info<AP2>,
Chris@16 218 case_SHN, // (6)
Chris@16 219 case_SAN // (4)
Chris@16 220
Chris@16 221 >::type
Chris@16 222
Chris@16 223 >::type,
Chris@16 224
Chris@16 225 case_SHA // (8)
Chris@16 226
Chris@16 227 >::type
Chris@16 228
Chris@16 229 >::type
Chris@16 230
Chris@16 231 >::type type;
Chris@16 232
Chris@16 233 };
Chris@16 234
Chris@16 235 #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES
Chris@16 236
Chris@16 237 } // namespace detail
Chris@16 238 } // namespace bimaps
Chris@16 239 } // namespace boost
Chris@16 240
Chris@16 241
Chris@16 242 #endif // BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP
Chris@16 243