Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/spirit/home/phoenix/statement/do_while.hpp @ 16:2665513ce2d3
Add boost headers
author | Chris Cannam |
---|---|
date | Tue, 05 Aug 2014 11:11:38 +0100 |
parents | |
children |
rev | line source |
---|---|
Chris@16 | 1 /*============================================================================= |
Chris@16 | 2 Copyright (c) 2001-2007 Joel de Guzman |
Chris@16 | 3 |
Chris@16 | 4 Distributed under the Boost Software License, Version 1.0. (See accompanying |
Chris@16 | 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 6 ==============================================================================*/ |
Chris@16 | 7 #ifndef PHOENIX_STATEMENT_DO_WHILE_HPP |
Chris@16 | 8 #define PHOENIX_STATEMENT_DO_WHILE_HPP |
Chris@16 | 9 |
Chris@16 | 10 #include <boost/spirit/home/phoenix/core/composite.hpp> |
Chris@16 | 11 #include <boost/spirit/home/phoenix/core/compose.hpp> |
Chris@16 | 12 |
Chris@16 | 13 namespace boost { namespace phoenix |
Chris@16 | 14 { |
Chris@16 | 15 struct do_while_eval |
Chris@16 | 16 { |
Chris@16 | 17 template <typename Env, typename Cond, typename Do> |
Chris@16 | 18 struct result |
Chris@16 | 19 { |
Chris@16 | 20 typedef void type; |
Chris@16 | 21 }; |
Chris@16 | 22 |
Chris@16 | 23 template <typename RT, typename Env, typename Cond, typename Do> |
Chris@16 | 24 static void |
Chris@16 | 25 eval(Env const& env, Cond& cond, Do& do_) |
Chris@16 | 26 { |
Chris@16 | 27 do |
Chris@16 | 28 do_.eval(env); |
Chris@16 | 29 while (cond.eval(env)); |
Chris@16 | 30 } |
Chris@16 | 31 }; |
Chris@16 | 32 |
Chris@16 | 33 template <typename Do> |
Chris@16 | 34 struct do_while_gen |
Chris@16 | 35 { |
Chris@16 | 36 do_while_gen(Do const& do_) |
Chris@16 | 37 : do_(do_) {} |
Chris@16 | 38 |
Chris@16 | 39 template <typename Cond> |
Chris@16 | 40 actor<typename as_composite<do_while_eval, Cond, Do>::type> |
Chris@16 | 41 while_(Cond const& cond) const |
Chris@16 | 42 { |
Chris@16 | 43 return compose<do_while_eval>(cond, do_); |
Chris@16 | 44 } |
Chris@16 | 45 |
Chris@16 | 46 Do do_; |
Chris@16 | 47 }; |
Chris@16 | 48 |
Chris@16 | 49 struct do_gen |
Chris@16 | 50 { |
Chris@16 | 51 template <typename Do> |
Chris@16 | 52 do_while_gen<Do> |
Chris@16 | 53 operator[](Do const& do_) const |
Chris@16 | 54 { |
Chris@16 | 55 return do_while_gen<Do>(do_); |
Chris@16 | 56 } |
Chris@16 | 57 }; |
Chris@16 | 58 |
Chris@16 | 59 do_gen const do_ = do_gen(); |
Chris@16 | 60 }} |
Chris@16 | 61 |
Chris@16 | 62 #endif |