annotate DEPENDENCIES/generic/include/boost/mpl/map/aux_/at_impl.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
Chris@16 2 #ifndef BOOST_MPL_MAP_AUX_AT_IMPL_HPP_INCLUDED
Chris@16 3 #define BOOST_MPL_MAP_AUX_AT_IMPL_HPP_INCLUDED
Chris@16 4
Chris@16 5 // Copyright Aleksey Gurtovoy 2003-2004
Chris@16 6 // Copyright David Abrahams 2003-2004
Chris@16 7 //
Chris@16 8 // Distributed under the Boost Software License, Version 1.0.
Chris@16 9 // (See accompanying file LICENSE_1_0.txt or copy at
Chris@16 10 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 11 //
Chris@16 12 // See http://www.boost.org/libs/mpl for documentation.
Chris@16 13
Chris@101 14 // $Id$
Chris@101 15 // $Date$
Chris@101 16 // $Revision$
Chris@16 17
Chris@16 18 #include <boost/mpl/at_fwd.hpp>
Chris@16 19 #include <boost/mpl/long.hpp>
Chris@16 20 #include <boost/mpl/map/aux_/tag.hpp>
Chris@16 21 #include <boost/mpl/aux_/order_impl.hpp>
Chris@16 22 #include <boost/mpl/aux_/overload_names.hpp>
Chris@16 23 #include <boost/mpl/aux_/type_wrapper.hpp>
Chris@16 24 #include <boost/mpl/aux_/ptr_to_ref.hpp>
Chris@16 25 #include <boost/mpl/aux_/static_cast.hpp>
Chris@16 26 #include <boost/mpl/aux_/config/typeof.hpp>
Chris@16 27 #include <boost/mpl/aux_/config/ctps.hpp>
Chris@16 28
Chris@16 29 #if !defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
Chris@16 30 # include <boost/mpl/eval_if.hpp>
Chris@16 31 # include <boost/mpl/pair.hpp>
Chris@16 32 # include <boost/mpl/void.hpp>
Chris@16 33 # include <boost/mpl/aux_/config/static_constant.hpp>
Chris@16 34 #endif
Chris@16 35
Chris@16 36 namespace boost { namespace mpl {
Chris@16 37
Chris@16 38 #if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
Chris@16 39
Chris@16 40 template< typename Map, typename Key >
Chris@16 41 struct m_at
Chris@16 42 {
Chris@16 43 typedef aux::type_wrapper<Key> key_;
Chris@16 44 typedef __typeof__( BOOST_MPL_AUX_OVERLOAD_CALL_VALUE_BY_KEY(
Chris@16 45 Map
Chris@16 46 , BOOST_MPL_AUX_STATIC_CAST(key_*, 0)
Chris@16 47 ) ) type;
Chris@16 48 };
Chris@16 49
Chris@16 50 template<>
Chris@16 51 struct at_impl< aux::map_tag >
Chris@16 52 {
Chris@16 53 template< typename Map, typename Key > struct apply
Chris@16 54 : aux::wrapped_type< typename m_at<
Chris@16 55 Map
Chris@16 56 , Key
Chris@16 57 >::type >
Chris@16 58 {
Chris@16 59 };
Chris@16 60 };
Chris@16 61
Chris@16 62 // agurt 31/jan/04: two-step implementation for the sake of GCC 3.x
Chris@16 63 template< typename Map, long order >
Chris@16 64 struct item_by_order_impl
Chris@16 65 {
Chris@16 66 typedef __typeof__( BOOST_MPL_AUX_OVERLOAD_CALL_ITEM_BY_ORDER(
Chris@16 67 Map
Chris@16 68 , BOOST_MPL_AUX_STATIC_CAST(long_<order>*, 0)
Chris@16 69 ) ) type;
Chris@16 70 };
Chris@16 71
Chris@16 72 template< typename Map, long order >
Chris@16 73 struct item_by_order
Chris@16 74 : aux::wrapped_type<
Chris@16 75 typename item_by_order_impl<Map,order>::type
Chris@16 76 >
Chris@16 77 {
Chris@16 78 };
Chris@16 79
Chris@16 80 #else // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
Chris@16 81
Chris@16 82 # if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
Chris@16 83
Chris@16 84 template< typename Map, long n > struct m_at
Chris@16 85 {
Chris@16 86 typedef void_ type;
Chris@16 87 };
Chris@16 88
Chris@16 89 # else
Chris@16 90
Chris@16 91 template< long n > struct m_at_impl
Chris@16 92 {
Chris@16 93 template< typename Map > struct result_
Chris@16 94 {
Chris@16 95 typedef void_ type;
Chris@16 96 };
Chris@16 97 };
Chris@16 98
Chris@16 99 template< typename Map, long n > struct m_at
Chris@16 100 {
Chris@16 101 typedef typename m_at_impl<n>::result_<Map>::type type;
Chris@16 102 };
Chris@16 103
Chris@16 104 # endif
Chris@16 105
Chris@16 106
Chris@16 107 template<>
Chris@16 108 struct at_impl< aux::map_tag >
Chris@16 109 {
Chris@16 110 template< typename Map, typename Key > struct apply
Chris@16 111 {
Chris@16 112 typedef typename m_at< Map, (x_order_impl<Map,Key>::value - 2) >::type item_;
Chris@16 113 typedef typename eval_if<
Chris@16 114 is_void_<item_>
Chris@16 115 , void_
Chris@16 116 , second<item_>
Chris@16 117 >::type type;
Chris@16 118 };
Chris@16 119 };
Chris@16 120
Chris@16 121 template< typename Map, long order > struct is_item_masked
Chris@16 122 {
Chris@16 123 BOOST_STATIC_CONSTANT(bool, value =
Chris@16 124 sizeof( BOOST_MPL_AUX_OVERLOAD_CALL_IS_MASKED(
Chris@16 125 Map
Chris@16 126 , BOOST_MPL_AUX_STATIC_CAST(long_<order>*, 0)
Chris@16 127 ) ) == sizeof(aux::yes_tag)
Chris@16 128 );
Chris@16 129 };
Chris@16 130
Chris@16 131 template< typename Map, long order > struct item_by_order
Chris@16 132 {
Chris@16 133 typedef typename eval_if_c<
Chris@16 134 is_item_masked<Map,order>::value
Chris@16 135 , void_
Chris@16 136 , m_at<Map,(order - 2)>
Chris@16 137 >::type type;
Chris@16 138 };
Chris@16 139
Chris@16 140 #endif
Chris@16 141
Chris@16 142 }}
Chris@16 143
Chris@16 144 #endif // BOOST_MPL_SET_AUX_AT_IMPL_HPP_INCLUDED