|
||||
File indexing completed on 2025-01-18 09:50:31
0001 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES) 0002 0003 #include <boost/proto/transform/detail/preprocessed/when.hpp> 0004 0005 #elif !defined(BOOST_PP_IS_ITERATING) 0006 0007 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) 0008 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/when.hpp") 0009 #endif 0010 0011 /////////////////////////////////////////////////////////////////////////////// 0012 /// \file when.hpp 0013 /// Definition of when transform. 0014 // 0015 // Copyright 2008 Eric Niebler. Distributed under the Boost 0016 // Software License, Version 1.0. (See accompanying file 0017 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0018 0019 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) 0020 #pragma wave option(preserve: 1) 0021 #endif 0022 0023 #define BOOST_PP_ITERATION_PARAMS_1 \ 0024 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/when.hpp>)) 0025 #include BOOST_PP_ITERATE() 0026 0027 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES) 0028 #pragma wave option(output: null) 0029 #endif 0030 0031 #else 0032 0033 #define N BOOST_PP_ITERATION() 0034 0035 /// \brief A grammar element and a PrimitiveTransform that associates 0036 /// a transform with the grammar. 0037 /// 0038 /// Use <tt>when\<\></tt> to override a grammar's default transform 0039 /// with a custom transform. It is for used when composing larger 0040 /// transforms by associating smaller transforms with individual 0041 /// rules in your grammar, as in the following transform which 0042 /// counts the number of terminals in an expression. 0043 /// 0044 /// \code 0045 /// // Count the terminals in an expression tree. 0046 /// // Must be invoked with initial state == mpl::int_<0>(). 0047 /// struct CountLeaves 0048 /// : or_< 0049 /// when<terminal<_>, mpl::next<_state>()> 0050 /// , otherwise<fold<_, _state, CountLeaves> > 0051 /// > 0052 /// {}; 0053 /// \endcode 0054 /// 0055 /// The <tt>when\<G, R(A0,A1,...)\></tt> form accepts either a 0056 /// CallableTransform or an ObjectTransform as its second parameter. 0057 /// <tt>when\<\></tt> uses <tt>is_callable\<R\>::value</tt> to 0058 /// distinguish between the two, and uses <tt>call\<\></tt> to 0059 /// evaluate CallableTransforms and <tt>make\<\></tt> to evaluate 0060 /// ObjectTransforms. 0061 template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> 0062 struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A))> 0063 : detail::when_impl<Grammar, R, R(BOOST_PP_ENUM_PARAMS(N, A))> 0064 {}; 0065 0066 #if N > 0 0067 /// \brief A grammar element and a PrimitiveTransform that associates 0068 /// a transform with the grammar. 0069 /// 0070 /// Use <tt>when\<\></tt> to override a grammar's default transform 0071 /// with a custom transform. It is for used when composing larger 0072 /// transforms by associating smaller transforms with individual 0073 /// rules in your grammar, as in the following transform which 0074 /// counts the number of terminals in an expression. 0075 /// 0076 /// \code 0077 /// // Count the terminals in an expression tree. 0078 /// // Must be invoked with initial state == mpl::int_<0>(). 0079 /// struct CountLeaves 0080 /// : or_< 0081 /// when<terminal<_>, mpl::next<_state>()> 0082 /// , otherwise<fold<_, _state, CountLeaves> > 0083 /// > 0084 /// {}; 0085 /// \endcode 0086 /// 0087 /// The <tt>when\<G, R(A0,A1,...)\></tt> form accepts either a 0088 /// CallableTransform or an ObjectTransform as its second parameter. 0089 /// <tt>when\<\></tt> uses <tt>is_callable\<R\>::value</tt> to 0090 /// distinguish between the two, and uses <tt>call\<\></tt> to 0091 /// evaluate CallableTransforms and <tt>make\<\></tt> to evaluate 0092 /// ObjectTransforms. 0093 template<typename Grammar, typename R BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)> 0094 struct when<Grammar, R(BOOST_PP_ENUM_PARAMS(N, A)...)> 0095 : detail::when_impl<Grammar, R, R(BOOST_PP_ENUM_PARAMS(N, A)...)> 0096 {}; 0097 #endif 0098 0099 #undef N 0100 0101 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |