1 ///////////////////////////////////////////////////////////////////////////////
3 /// Contains helpers for pseudo-pack expansion.
5 // Copyright 2012 Eric Niebler. Distributed under the Boost
6 // Software License, Version 1.0. (See accompanying file
7 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
10 #define BOOST_PROTO_TRANSFORM_DETAIL_PACK_HPP_EAN_2012_07_11
12 #include <boost/preprocessor/cat.hpp>
13 #include <boost/preprocessor/arithmetic/inc.hpp>
14 #include <boost/preprocessor/arithmetic/dec.hpp>
15 #include <boost/preprocessor/arithmetic/sub.hpp>
16 #include <boost/preprocessor/punctuation/comma_if.hpp>
17 #include <boost/preprocessor/repetition/enum.hpp>
18 #include <boost/preprocessor/repetition/enum_params.hpp>
19 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
20 #include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
21 #include <boost/preprocessor/repetition/repeat.hpp>
22 #include <boost/preprocessor/iteration/local.hpp>
23 #include <boost/preprocessor/iteration/iterate.hpp>
24 #include <boost/mpl/bool.hpp>
25 #include <boost/mpl/assert.hpp>
26 #include <boost/type_traits/is_same.hpp>
27 #include <boost/proto/proto_fwd.hpp>
30 # pragma warning(push)
31 # pragma warning(disable: 4348) // redefinition of default parameter
34 namespace boost { namespace proto
38 template<typename Fun>
39 struct msvc_fun_workaround;
41 template<typename Tfx, typename T>
42 struct expand_pattern_helper
45 typedef mpl::false_ applied;
48 template<typename Tfx, typename Fun>
49 struct expand_pattern_helper<Tfx, Fun *>
50 : expand_pattern_helper<Tfx, Fun>
53 template<typename Tfx, typename T>
54 struct expand_pattern_helper<Tfx, pack(T)>
56 // BUGBUG fix me. See comment in transform/detail/call.hpp
58 (is_same<T, _>::value)
59 , PACK_EXPANSIONS_OF_EXPRESSIONS_OTHER_THAN_THE_CURRENT_NOT_YET_SUPPORTED
63 typedef mpl::true_ applied;
66 template<typename Tfx>
67 struct expand_pattern_helper<Tfx, pack(_)>
70 typedef mpl::true_ applied;
73 #include <boost/proto/transform/detail/expand_pack.hpp>
75 template<long Arity, typename Fun, typename Cont>
76 struct expand_pattern;
78 template<typename Fun, typename Cont>
79 struct expand_pattern<0, Fun, Cont>
80 : Cont::template cat<typename expand_pattern_helper<proto::_value, Fun>::type>
83 (expand_pattern_helper<proto::_value, Fun>::applied::value)
84 , NO_PACK_EXPRESSION_FOUND_IN_PACK_EXPANSION
89 #include <boost/proto/transform/detail/pack_impl.hpp>