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

value<> is a lazy wrapper for a value that can be used in xpressive semantic actions. More...

#include <xpressive_fwd.hpp>

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

Public Types

typedef proto::extends
< typename proto::terminal< T >
::type, value< T > > 
base_type
 INTERNAL ONLY. More...
 

Public Member Functions

 value ()
 Store a default-constructed T. More...
 
 value (T const &t)
 Store a copy of t. More...
 
Tget ()
 
T const & get () const
 Fetch the stored value. More...
 

Detailed Description

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

value<> is a lazy wrapper for a value that can be used in xpressive semantic actions.

Template Parameters
TThe type of the value to store.

Below is an example that shows where value<> is useful.

{
using namespace boost::xpressive;
// Use val() to hold the shared_ptr by value:
sregex rex = +( _d [ ++*val(pi) ] >> '!' );
// OK, rex holds a reference count to the integer.
return rex;
}

In the above code, xpressive::val() is a function that returns a value<> object. Had val() not been used here, the operation ++*pi would have been evaluated eagerly once, instead of lazily when the regex match happens.

Member Typedef Documentation

template<typename T >
typedef proto::extends<typename proto::terminal<T>::type, value<T> > boost::xpressive::value< T >::base_type

INTERNAL ONLY.

Constructor & Destructor Documentation

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

Store a default-constructed T.

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

Store a copy of t.

Parameters
tThe initial value.

Member Function Documentation

template<typename T >
T& boost::xpressive::value< T >::get ( )
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().

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

Fetch the stored value.

References boost::proto::value().


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