Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:47:40

0001 /*==============================================================================
0002     Copyright (c) 2001-2010 Joel de Guzman
0003     Copyright (c) 2010 Thomas Heller
0004 
0005     Distributed under the Boost Software License, Version 1.0. (See accompanying
0006     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0007 ==============================================================================*/
0008 #ifndef BOOST_PHOENIX_STATEMENT_WHILE_HPP
0009 #define BOOST_PHOENIX_STATEMENT_WHILE_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)(while_)
0018   , (meta_grammar) // Cond
0019     (meta_grammar) // Do
0020 )
0021 
0022 namespace boost { namespace phoenix
0023 {
0024     struct while_eval
0025     {
0026         typedef void result_type;
0027 
0028         template <typename Cond, typename Do, typename Context>
0029         result_type
0030         operator()(Cond const& cond, Do const& do_it, Context const & ctx) const
0031         {
0032             while(boost::phoenix::eval(cond, ctx))
0033             {
0034                 boost::phoenix::eval(do_it, ctx);
0035             }
0036         }
0037     };
0038     
0039     template <typename Dummy>
0040     struct default_actions::when<rule::while_, Dummy>
0041         : call<while_eval, Dummy>
0042     {};
0043 
0044     template <typename Cond>
0045     struct while_gen
0046     {
0047         while_gen(Cond const& cond_) : cond(cond_) {}
0048 
0049         template <typename Do>
0050         typename expression::while_<Cond, Do>::type const
0051         operator[](Do const& do_it) const
0052         {
0053             return expression::while_<Cond, Do>::make(cond, do_it);
0054         }
0055 
0056         Cond const& cond;
0057     };
0058 
0059     template <typename Cond>
0060     inline
0061     while_gen<Cond> const
0062     while_(Cond const& cond)
0063     {
0064         return while_gen<Cond>(cond);
0065     }
0066 
0067 
0068 }}
0069 
0070 #endif