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_DO_WHILE_HPP
0009 #define BOOST_PHOENIX_STATEMENT_DO_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)(do_while)
0018   , (meta_grammar) // Cond
0019     (meta_grammar) // Do
0020 )
0021 
0022 namespace boost { namespace phoenix
0023 {
0024     struct do_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             do
0033                 boost::phoenix::eval(do_it, ctx);
0034             while (boost::phoenix::eval(cond, ctx));
0035         }
0036     };
0037     
0038     template <typename Dummy>
0039     struct default_actions::when<rule::do_while, Dummy>
0040         : call<do_while_eval, Dummy>
0041     {};
0042 
0043     template <typename Do>
0044     struct do_while_gen
0045     {
0046         do_while_gen(Do const& do_it)
0047             : do_(do_it) {}
0048 
0049         template <typename Cond>
0050         typename expression::do_while<Cond, Do>::type const
0051         while_(Cond const& cond) const
0052         {
0053             return expression::do_while<Cond, Do>::make(cond, do_);
0054         }
0055 
0056         Do const& do_;
0057     };
0058 
0059     struct do_gen
0060     {
0061         template <typename Do>
0062         do_while_gen<Do> const
0063         operator[](Do const& do_) const
0064         {
0065             return do_while_gen<Do>(do_);
0066         }
0067     };
0068 
0069 #ifndef BOOST_PHOENIX_NO_PREDEFINED_TERMINALS
0070     do_gen const do_ = {};
0071 #endif
0072 
0073 }}
0074 
0075 #endif