Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:50:31

0001 ///////////////////////////////////////////////////////////////////////////////
0002 /// \file pack.hpp
0003 /// Contains helpers for pseudo-pack expansion.
0004 //
0005 //  Copyright 2012 Eric Niebler. Distributed under the Boost
0006 //  Software License, Version 1.0. (See accompanying file
0007 //  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #ifndef BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
0010 #define BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
0011 
0012 #include <boost/preprocessor/cat.hpp>
0013 #include <boost/preprocessor/arithmetic/inc.hpp>
0014 #include <boost/preprocessor/arithmetic/dec.hpp>
0015 #include <boost/preprocessor/arithmetic/sub.hpp>
0016 #include <boost/preprocessor/punctuation/comma_if.hpp>
0017 #include <boost/preprocessor/repetition/enum.hpp>
0018 #include <boost/preprocessor/repetition/enum_params.hpp>
0019 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
0020 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
0021 #include <boost/preprocessor/repetition/repeat.hpp>
0022 #include <boost/preprocessor/iteration/local.hpp>
0023 #include <boost/preprocessor/iteration/iterate.hpp>
0024 #include <boost/mpl/bool.hpp>
0025 #include <boost/mpl/assert.hpp>
0026 #include <boost/type_traits/is_same.hpp>
0027 #include <boost/proto/proto_fwd.hpp>
0028 
0029 #if defined(_MSC_VER)
0030 # pragma warning(push)
0031 # pragma warning(disable: 4348) // redefinition of default parameter
0032 #endif
0033 
0034 namespace boost { namespace proto
0035 {
0036     namespace detail
0037     {
0038         template<typename Fun>
0039         struct msvc_fun_workaround;
0040 
0041         template<typename Tfx, typename T>
0042         struct expand_pattern_helper
0043         {
0044             typedef T type;
0045             typedef mpl::false_ applied;
0046         };
0047 
0048         template<typename Tfx, typename Fun>
0049         struct expand_pattern_helper<Tfx, Fun *>
0050           : expand_pattern_helper<Tfx, Fun>
0051         {};
0052 
0053         template<typename Tfx, typename T>
0054         struct expand_pattern_helper<Tfx, pack(T)>
0055         {
0056             // BUGBUG fix me. See comment in transform/detail/call.hpp
0057             BOOST_MPL_ASSERT_MSG(
0058                 (is_same<T, _>::value)
0059               , PACK_EXPANSIONS_OF_EXPRESSIONS_OTHER_THAN_THE_CURRENT_NOT_YET_SUPPORTED
0060               , (T)
0061             );
0062             typedef Tfx type(T);
0063             typedef mpl::true_ applied;
0064         };
0065 
0066         template<typename Tfx>
0067         struct expand_pattern_helper<Tfx, pack(_)>
0068         {
0069             typedef Tfx type;
0070             typedef mpl::true_ applied;
0071         };
0072 
0073         #include <boost/proto/transform/detail/expand_pack.hpp>
0074 
0075         template<long Arity, typename Fun, typename Cont>
0076         struct expand_pattern;
0077 
0078         template<typename Fun, typename Cont>
0079         struct expand_pattern<0, Fun, Cont>
0080           : Cont::template cat<typename expand_pattern_helper<proto::_value, Fun>::type>
0081         {
0082             BOOST_MPL_ASSERT_MSG(
0083                 (expand_pattern_helper<proto::_value, Fun>::applied::value)
0084               , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
0085               , (Fun)
0086             );
0087         };
0088 
0089         #include <boost/proto/transform/detail/pack_impl.hpp>
0090     }
0091 }}
0092 
0093 #if defined(_MSC_VER)
0094 # pragma warning(pop)
0095 #endif
0096 
0097 #endif