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

A wildcard grammar element that matches any expression, and a transform that returns the current expression unchanged. More...

#include <matches.hpp>

Inheritance diagram for boost::proto::_:
Collaboration diagram for boost::proto::_:

Classes

struct  impl
 

Public Types

typedef _ proto_grammar
 
typedef _ 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
 

Detailed Description

A wildcard grammar element that matches any expression, and a transform that returns the current expression unchanged.

The wildcard type, _, is a grammar element such that matches<E,_>value is true for any expression type E.

The wildcard can also be used as a stand-in for a template argument when matching terminals. For instance, the following is a grammar that will match any std::complex<> terminal:

terminal<std::complex<double> >::type
, terminal<std::complex< _ > >
>
));

When used as a transform, _ returns the current expression unchanged. For instance, in the following, _ is used with the fold<> transform to fold the children of a node:

struct CountChildren
: or_<
// Terminals have no children
when<terminal<_>, mpl::int_<0>()>
// Use fold<> to count the children of non-terminals
, otherwise<
fold<
_ // <-- fold the current expression
, mpl::int_<0>()
, mpl::plus<_state, mpl::int_<1> >()
>
>
>
{};

Member Typedef Documentation

typedef _ boost::proto::transform< _ , X >::transform_type
inherited

Member Function Documentation

boost::proto::transform< _ , X >::BOOST_PROTO_CALLABLE ( )
inherited
BOOST_FORCEINLINE boost::proto::detail::apply_transform<transform_type(Expr const &, State const &, Data const &)>::result_type boost::proto::transform< _ , X >::operator() ( Expr &&  e,
State &&  s,
Data &&  d 
) const
inlineinherited
BOOST_FORCEINLINE boost::proto::detail::apply_transform<transform_type(Expr const &, State const &)>::result_type boost::proto::transform< _ , X >::operator() ( Expr &&  e,
State &&  s 
) const
inlineinherited
BOOST_FORCEINLINE boost::proto::detail::apply_transform<transform_type(Expr const &)>::result_type boost::proto::transform< _ , X >::operator() ( Expr &&  e) const
inlineinherited

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