File indexing completed on 2025-01-18 09:47:40
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_PHOENIX_STATEMENT_FOR_HPP
0009 #define BOOST_PHOENIX_STATEMENT_FOR_HPP
0010
0011 #include <boost/phoenix/core/limits.hpp>
0012 #include <boost/phoenix/core/call.hpp>
0013 #include <boost/phoenix/core/expression.hpp>
0014 #include <boost/phoenix/core/meta_grammar.hpp>
0015
0016 BOOST_PHOENIX_DEFINE_EXPRESSION(
0017 (boost)(phoenix)(for_)
0018 , (meta_grammar)
0019 (meta_grammar)
0020 (meta_grammar)
0021 (meta_grammar)
0022 )
0023
0024 namespace boost { namespace phoenix
0025 {
0026 struct for_eval
0027 {
0028 typedef void result_type;
0029
0030 template <
0031 typename Init
0032 , typename Cond
0033 , typename Step
0034 , typename Do
0035 , typename Context
0036 >
0037 result_type
0038 operator()(
0039 Init const& init
0040 , Cond const& cond
0041 , Step const& step
0042 , Do const& do_it
0043 , Context const & ctx
0044 ) const
0045 {
0046 for(boost::phoenix::eval(init, ctx); boost::phoenix::eval(cond, ctx); boost::phoenix::eval(step, ctx))
0047 boost::phoenix::eval(do_it, ctx);
0048 }
0049 };
0050
0051 template <typename Dummy>
0052 struct default_actions::when<rule::for_, Dummy>
0053 : call<for_eval, Dummy>
0054 {};
0055
0056 template <typename Init, typename Cond, typename Step>
0057 struct for_gen
0058 {
0059 for_gen(Init const& init_, Cond const& cond_, Step const& step_)
0060 : init(init_), cond(cond_), step(step_) {}
0061
0062 template <typename Do>
0063 typename expression::for_<Init, Cond, Step, Do>::type const
0064 operator[](Do const& do_it) const
0065 {
0066 return
0067 expression::
0068 for_<Init, Cond, Step, Do>::
0069 make(init, cond, step, do_it);
0070 }
0071
0072 Init init;
0073 Cond cond;
0074 Step step;
0075 };
0076
0077 template <typename Init, typename Cond, typename Step>
0078 inline
0079 for_gen<Init, Cond, Step> const
0080 for_(Init const& init, Cond const& cond, Step const& step)
0081 {
0082 return for_gen<Init, Cond, Step>(init, cond, step);
0083 }
0084
0085 }}
0086
0087 #endif