Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

while_ Statement

#include <boost/phoenix/statement/while.hpp>

The syntax is:

while_(conditional_expression)
[
    sequenced_statements
]

Example: This code decrements each element until it reaches zero and prints out the number at each step. A newline terminates the printout of each value.

std::for_each(c.begin(), c.end(),
    (
        while_(arg1--)
        [
            cout << arg1 << ", "
        ],
        cout << val("\n")
    )
);

PrevUpHomeNext