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

local<> is a lazy wrapper for a reference to a value that is stored within the local itself. More...

#include <xpressive_fwd.hpp>

Inheritance diagram for boost::xpressive::local< T >:
Collaboration diagram for boost::xpressive::local< T >:

Public Types

typedef proto::terminal
< reference_wrapper< T >
>::type 
base_type
 INTERNAL ONLY. More...
 

Public Member Functions

 local ()
 Store a default-constructed value of type T. More...
 
 local (T const &t)
 Store a default-constructed value of type T. More...
 
Tget ()
 Fetch the wrapped value. More...
 
T const & get () const
 

Public Attributes

T value
 

Detailed Description

template<typename T>
struct boost::xpressive::local< T >

local<> is a lazy wrapper for a reference to a value that is stored within the local itself.

It is for use within xpressive semantic actions.

Template Parameters
TThe type of the local variable.

Below is an example of how to use local<> in semantic actions.

using namespace boost::xpressive;
std::string str("1!2!3?");
// count the exciting digits, but not the
// questionable ones.
sregex rex = +( _d [ ++i ] >> '!' );
assert( i.get() == 2 );
Note
As the name "local" suggests, local<> objects and the regexes that refer to them should never leave the local scope. The value stored within the local object will be destroyed at the end of the local<>'s lifetime, and any regex objects still holding the local<> will be left with a dangling reference.

Member Typedef Documentation

INTERNAL ONLY.

Constructor & Destructor Documentation

template<typename T>
boost::xpressive::local< T >::local ( )
inline

Store a default-constructed value of type T.

template<typename T>
boost::xpressive::local< T >::local ( T const &  t)
inlineexplicit

Store a default-constructed value of type T.

Parameters
tThe initial value.

Member Function Documentation

template<typename T>
T& boost::xpressive::local< T >::get ( )
inline

Fetch the wrapped value.

References boost::proto::value().

template<typename T>
T const& boost::xpressive::local< T >::get ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References boost::proto::value().

Member Data Documentation

template<typename T >
T boost::xpressive::detail::value_wrapper< T >::value
inherited

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