Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::proto::otherwise< Fun > Struct Template Reference

Syntactic sugar for when<_, Fun>, for use in grammars to handle all the cases not yet handled. More...

#include <when.hpp>

Inheritance diagram for boost::proto::otherwise< Fun >:
Collaboration diagram for boost::proto::otherwise< Fun >:

Public Types

typedef _ first
 
typedef Fun second
 
typedef _::proto_grammar proto_grammar
 

Detailed Description

template<typename Fun>
struct boost::proto::otherwise< Fun >

Syntactic sugar for when<_, Fun>, for use in grammars to handle all the cases not yet handled.

Use otherwise<T> in your grammars as a synonym for when<_, T> as in the following transform which counts the number of terminals in an expression.

// Count the terminals in an expression tree.
// Must be invoked with initial state == mpl::int_<0>().
struct CountLeaves
: or_<
when<terminal<_>, mpl::next<_state>()>
, otherwise<fold<_, _state, CountLeaves> >
>
{};

Member Typedef Documentation

typedef _ boost::proto::when< _ , Fun >::first
inherited
typedef _ ::proto_grammar boost::proto::when< _ , Fun >::proto_grammar
inherited
typedef Fun boost::proto::when< _ , Fun >::second
inherited

The documentation for this struct was generated from the following file: