Chris@16: // Boost.Bimap Chris@16: // Chris@16: // Copyright (c) 2006-2007 Matias Capeletto Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: /// \file detail/manage_additional_parameters.hpp Chris@16: /// \brief Utility class to extract the additional parameters from the template parameters. Chris@16: Chris@16: #ifndef BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP Chris@16: #define BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP Chris@16: Chris@101: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: // Boost.MPL Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: namespace bimaps { Chris@16: Chris@16: template< class Type > Chris@16: struct with_info Chris@16: { Chris@16: typedef Type value_type; Chris@16: }; Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: /// \brief Metafunction to check if a given type is a data_hook specification. Chris@16: Chris@16: template< class Type > Chris@16: struct is_with_info : ::boost::mpl::false_ {}; Chris@16: Chris@16: template< class ValueType > Chris@16: struct is_with_info< with_info > : ::boost::mpl::true_ {}; Chris@16: Chris@16: /** \struct boost::bimaps::detail::manage_additional_parameters Chris@16: \brief Utility class to extract the additional parameters from the template parameters. Chris@16: Chris@16: \code Chris@16: template< class AP1, class AP2, class AP3 > Chris@16: struct manage_additional_parameters Chris@16: { Chris@16: struct parameters Chris@16: { Chris@16: typedef -unspecified- set_type_of_relation; Chris@16: typedef -unspecified- data_hook; Chris@16: typedef -unspecified- allocator; Chris@16: }; Chris@16: Chris@16: typedef parameters type; Chris@16: }; Chris@16: \endcode Chris@16: Chris@16: See also bimap, bimap_core. Chris@16: **/ Chris@16: Chris@16: #ifndef BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES Chris@16: Chris@16: template< class AP1, class AP2, class AP3 > Chris@16: struct manage_additional_parameters Chris@16: { Chris@16: // (1) manage_additional_parameters< Chris@16: // not_specified,not_specified,not_specified> Chris@16: // Chris@16: // set_type_of_relation: based on the left key type Chris@16: // info_hook: no additional info Chris@16: // allocator: default allocator Chris@16: Chris@16: struct case_NNN Chris@16: { Chris@16: typedef left_based set_type_of_relation; Chris@16: typedef std::allocator allocator; Chris@16: typedef ::boost::mpl::na additional_info; Chris@16: }; Chris@16: Chris@16: // (2) manage_additional_parameters Chris@16: // Chris@16: // set_type_of_relation: based on the left key type Chris@16: // info_hook: no additional info Chris@16: // allocator: Allocator Chris@16: Chris@16: struct case_ANN Chris@16: { Chris@16: typedef left_based set_type_of_relation; Chris@16: typedef AP1 allocator; Chris@16: typedef ::boost::mpl::na additional_info; Chris@16: }; Chris@16: Chris@16: // (3) manage_additional_parameters< Chris@16: // SetOfRelationType,not_specified,not_specified> Chris@16: // Chris@16: // set_type_of_relation: SetTypeOfRelation Chris@16: // info_hook: no additional info Chris@16: // allocator: default allocator Chris@16: Chris@16: struct case_SNN Chris@16: { Chris@16: typedef AP1 set_type_of_relation; Chris@16: typedef std::allocator allocator; Chris@16: typedef ::boost::mpl::na additional_info; Chris@16: }; Chris@16: Chris@16: // (4) manage_additional_parameters< Chris@16: // SetTypeOfRelation,Allocator,not_specified> Chris@16: // Chris@16: // set_type_of_relation: SetTypeOfRelation Chris@16: // info_hook: no additional info Chris@16: // allocator: Allocator Chris@16: Chris@16: struct case_SAN Chris@16: { Chris@16: typedef AP1 set_type_of_relation; Chris@16: typedef AP2 allocator; Chris@16: typedef ::boost::mpl::na additional_info; Chris@16: }; Chris@16: Chris@16: // (5) manage_additional_parameters Chris@16: // Chris@16: // set_type_of_relation: based on the left key type Chris@16: // info_hook: InfoToHook Chris@16: // allocator: default allocator Chris@16: Chris@16: struct case_HNN Chris@16: { Chris@16: typedef left_based set_type_of_relation; Chris@16: typedef std::allocator allocator; Chris@16: typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info; Chris@16: }; Chris@16: Chris@16: // (6) manage_additional_parameters< Chris@16: // SetTypeOfRelation,InfoToHook,not_specified> Chris@16: // Chris@16: // set_type_of_relation: SetTypeOfRelation Chris@16: // info_hook: InfoToHook Chris@16: // allocator: default allocator Chris@16: Chris@16: struct case_SHN Chris@16: { Chris@16: typedef AP1 set_type_of_relation; Chris@16: typedef std::allocator allocator; Chris@16: typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info; Chris@16: }; Chris@16: Chris@16: // (7) manage_additional_parameters< Chris@16: // DataToHook,Allocator,not_specified> Chris@16: // Chris@16: // set_type_of_relation: SetTypeOfRelation Chris@16: // info_hook: InfoToHook Chris@16: // allocator: default allocator Chris@16: Chris@16: struct case_HAN Chris@16: { Chris@16: typedef left_based set_type_of_relation; Chris@16: typedef AP2 allocator; Chris@16: typedef BOOST_DEDUCED_TYPENAME AP1::value_type additional_info; Chris@16: }; Chris@16: Chris@16: // (8) manage_additional_parameters< Chris@16: // SetTypeOfRelation,DataToHook,Allocator> Chris@16: // Chris@16: // set_type_of_relation: SetTypeOfRelation Chris@16: // info_hook: InfoToHook Chris@16: // allocator: Allocator Chris@16: Chris@16: struct case_SHA Chris@16: { Chris@16: typedef AP1 set_type_of_relation; Chris@16: typedef AP2 allocator; Chris@16: typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info; Chris@16: }; Chris@16: Chris@16: // Some annidated mpl::if_ and we are done! Chris@16: Chris@16: typedef BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: ::boost::mpl::is_na, Chris@16: case_NNN, // (1) Chris@16: BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: ::boost::mpl::is_na, Chris@16: BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: is_set_type_of_relation, Chris@16: case_SNN, // (3) Chris@16: BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: is_with_info, Chris@16: case_HNN, // (5) Chris@16: case_ANN // (2) Chris@16: Chris@16: >::type Chris@16: Chris@16: >::type, Chris@16: BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: ::boost::mpl::is_na, Chris@16: BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: is_with_info, Chris@16: case_HAN, // (7) Chris@16: BOOST_DEDUCED_TYPENAME mpl::if_ Chris@16: < Chris@16: is_with_info, Chris@16: case_SHN, // (6) Chris@16: case_SAN // (4) Chris@16: Chris@16: >::type Chris@16: Chris@16: >::type, Chris@16: Chris@16: case_SHA // (8) Chris@16: Chris@16: >::type Chris@16: Chris@16: >::type Chris@16: Chris@16: >::type type; Chris@16: Chris@16: }; Chris@16: Chris@16: #endif // BOOST_BIMAP_DOXYGEN_WILL_NOT_PROCESS_THE_FOLLOWING_LINES Chris@16: Chris@16: } // namespace detail Chris@16: } // namespace bimaps Chris@16: } // namespace boost Chris@16: Chris@16: Chris@16: #endif // BOOST_BIMAP_DETAIL_MANAGE_ADDITIONAL_PARAMETERS_HPP Chris@16: