Used to select one grammar or another based on the result of a compile-time Boolean. More...
#include <proto_fwd.hpp>
Classes | |
struct | impl |
Public Types | |
typedef if_ | proto_grammar |
typedef if_< If, Then, Else > | transform_type |
Public Member Functions | |
BOOST_PROTO_CALLABLE () typedef X proto_is_transform_ | |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &)> ::result_type | operator() (Expr &&e) const |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &, State const &)> ::result_type | operator() (Expr &&e, State &&s) const |
BOOST_FORCEINLINE boost::proto::detail::apply_transform < transform_type(Expr const &, State const &, Data const &)> ::result_type | operator() (Expr &&e, State &&s, Data &&d) const |
Used to select one grammar or another based on the result of a compile-time Boolean.
When used as a transform, if_<>
selects between two transforms based on a compile-time Boolean.
When if_<If,Then,Else>
is used as a grammar, If
must be a Proto transform and Then
and Else
must be grammars. An expression type E
matches if_<If,Then,Else>
if boost::result_of<when<_,If>(E,int,int)>::type::value
is true
and E
matches U
; or, if boost::result_of<when<_,If>(E,int,int)>::type::value
is false
and E
matches V
.
The template parameter Then
defaults to _
and Else
defaults to not<_>
, so an expression type E
will match if_<If>
if and only if boost::result_of<when<_,If>(E,int,int)>::type::value
is true
.
When if_<If,Then,Else>
is used as a transform, If
, Then
and Else
must be Proto transforms. When applying the transform to an expression E
, state S
and data V
, if boost::result_of<when<_,If>(E,S,V)>::type::value
is true
then the Then
transform is applied; otherwise the Else
transform is applied.
typedef if_ boost::proto::if_< If, Then, Else >::proto_grammar |
|
inherited |
|
inherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |