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

A unary metafunction that turns an ordinary function object type into the type of a deferred function object for use in xpressive semantic actions. More...

#include <regex_actions.hpp>

Public Types

typedef proto::terminal
< PolymorphicFunctionObject >
::type 
type
 

Detailed Description

template<typename PolymorphicFunctionObject>
struct boost::xpressive::function< PolymorphicFunctionObject >

A unary metafunction that turns an ordinary function object type into the type of a deferred function object for use in xpressive semantic actions.

Use xpressive::function<> to turn an ordinary polymorphic function object type into a type that can be used to declare an object for use in xpressive semantic actions.

For example, the global object xpressive::push_back can be used to create deferred actions that have the effect of pushing a value into a container. It is defined with xpressive::function<> as follows:

where op::push_back is an ordinary function object that pushes its second argument into its first. Thus defined, xpressive::push_back can be used in semantic actions as follows:

namespace xp = boost::xpressive;
using xp::_;
std::list<int> result;
std::string str("1 23 456 7890");
xp::sregex rx = (+_d)[ xp::push_back(xp::ref(result), xp::as<int>(_) ]
>> *(' ' >> (+_d)[ xp::push_back(xp::ref(result), xp::as<int>(_) ) ]);

Member Typedef Documentation

template<typename PolymorphicFunctionObject>
typedef proto::terminal<PolymorphicFunctionObject>::type boost::xpressive::function< PolymorphicFunctionObject >::type

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