PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/phoenix/doc/starter_kit/statement.qbk

http://hadesmem.googlecode.com/
text | 34 lines | 25 code | 9 blank | 0 comment | 0 complexity | e52b6fdff2241a8a53bbcd21c0a252c7 MD5 | raw file
 1[/==============================================================================
 2    Copyright (C) 2001-2010 Joel de Guzman
 3    Copyright (C) 2001-2005 Dan Marsden
 4    Copyright (C) 2001-2010 Thomas Heller
 5
 6    Distributed under the Boost Software License, Version 1.0. (See accompanying
 7    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 8===============================================================================/]
 9
10[section Lazy Statements]
11
12Lazy statements? Sure. There are lazy versions of the C++ statements we all know
13and love. For example:
14
15    if_(arg1 > 5)
16    [
17        std::cout << arg1
18    ]
19
20Say, for example, we wish to print all the elements that are greater than 5
21(separated by a comma) in a vector. Here's how we write it:
22
23    std::for_each(v.begin(), v.end(),
24        if_(arg1 > 5)
25        [
26            std::cout << arg1 << ", "
27        ]
28    );
29
30(See [@../../example/if.cpp if.cpp])
31
32[blurb __tip__ Learn more about statements [link phoenix.modules.statement here.]]
33
34[endsect]