Chris@16
|
1 #if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
|
Chris@16
|
2
|
Chris@16
|
3 #include <boost/proto/transform/detail/preprocessed/lazy.hpp>
|
Chris@16
|
4
|
Chris@16
|
5 #elif !defined(BOOST_PP_IS_ITERATING)
|
Chris@16
|
6
|
Chris@16
|
7 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
8 #pragma wave option(preserve: 2, line: 0, output: "preprocessed/lazy.hpp")
|
Chris@16
|
9 #endif
|
Chris@16
|
10
|
Chris@16
|
11 ///////////////////////////////////////////////////////////////////////////////
|
Chris@16
|
12 /// \file lazy.hpp
|
Chris@16
|
13 /// Contains definition of the lazy<> transform.
|
Chris@16
|
14 //
|
Chris@16
|
15 // Copyright 2008 Eric Niebler. Distributed under the Boost
|
Chris@16
|
16 // Software License, Version 1.0. (See accompanying file
|
Chris@16
|
17 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
18
|
Chris@16
|
19 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
20 #pragma wave option(preserve: 1)
|
Chris@16
|
21 #endif
|
Chris@16
|
22
|
Chris@16
|
23 #define BOOST_PP_ITERATION_PARAMS_1 \
|
Chris@16
|
24 (3, (0, BOOST_PROTO_MAX_ARITY, <boost/proto/transform/detail/lazy.hpp>))
|
Chris@16
|
25 #include BOOST_PP_ITERATE()
|
Chris@16
|
26
|
Chris@16
|
27 #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
|
Chris@16
|
28 #pragma wave option(output: null)
|
Chris@16
|
29 #endif
|
Chris@16
|
30
|
Chris@16
|
31 #else
|
Chris@16
|
32
|
Chris@16
|
33 #define N BOOST_PP_ITERATION()
|
Chris@16
|
34
|
Chris@16
|
35 /// \brief A PrimitiveTransform that uses <tt>make\<\></tt> to build
|
Chris@16
|
36 /// a CallableTransform, and then uses <tt>call\<\></tt> to apply it.
|
Chris@16
|
37 ///
|
Chris@16
|
38 /// <tt>lazy\<\></tt> is useful as a higher-order transform, when the
|
Chris@16
|
39 /// transform to be applied depends on the current state of the
|
Chris@16
|
40 /// transformation. The invocation of the <tt>make\<\></tt> transform
|
Chris@16
|
41 /// evaluates any nested transforms, and the resulting type is treated
|
Chris@16
|
42 /// as a CallableTransform, which is evaluated with <tt>call\<\></tt>.
|
Chris@16
|
43 template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
Chris@16
|
44 struct lazy<Object(BOOST_PP_ENUM_PARAMS(N, A))>
|
Chris@16
|
45 : transform<lazy<Object(BOOST_PP_ENUM_PARAMS(N, A))> >
|
Chris@16
|
46 {
|
Chris@16
|
47 template<typename Expr, typename State, typename Data>
|
Chris@16
|
48 struct impl
|
Chris@16
|
49 : call<
|
Chris@16
|
50 typename make<Object>::template impl<Expr, State, Data>::result_type
|
Chris@16
|
51 (BOOST_PP_ENUM_PARAMS(N, A))
|
Chris@16
|
52 >::template impl<Expr, State, Data>
|
Chris@16
|
53 {};
|
Chris@16
|
54 };
|
Chris@16
|
55
|
Chris@16
|
56 #if N > 0
|
Chris@16
|
57 template<typename Object BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
|
Chris@16
|
58 struct lazy<Object(BOOST_PP_ENUM_PARAMS(N, A)...)>
|
Chris@16
|
59 : transform<lazy<Object(BOOST_PP_ENUM_PARAMS(N, A)...)> >
|
Chris@16
|
60 {
|
Chris@16
|
61 template<typename Expr, typename State, typename Data>
|
Chris@16
|
62 struct impl
|
Chris@16
|
63 : lazy<
|
Chris@16
|
64 typename detail::expand_pattern<
|
Chris@16
|
65 proto::arity_of<Expr>::value
|
Chris@16
|
66 , BOOST_PP_CAT(A, BOOST_PP_DEC(N))
|
Chris@16
|
67 , detail::BOOST_PP_CAT(expand_pattern_rest_, BOOST_PP_DEC(N))<
|
Chris@16
|
68 Object
|
Chris@16
|
69 BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_DEC(N), A)
|
Chris@16
|
70 >
|
Chris@16
|
71 >::type
|
Chris@16
|
72 >::template impl<Expr, State, Data>
|
Chris@16
|
73 {};
|
Chris@16
|
74 };
|
Chris@16
|
75 #endif
|
Chris@16
|
76
|
Chris@16
|
77 #undef N
|
Chris@16
|
78
|
Chris@16
|
79 #endif
|