![]() |
Home | Libraries | People | FAQ | More |
boost::xpressive::local — 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.
// In header: <boost/xpressive/xpressive_fwd.hpp> template<typename T> struct local : public proto::terminal::type { // public member functions local(); explicit local(T const &); T & get(); T const & get() const; };
Below is an example of how to use local<>
in semantic actions.
using namespace boost::xpressive; local<int> i(0); std::string str("1!2!3?"); // count the exciting digits, but not the // questionable ones. sregex rex = +( _d [ ++i ] >> '!' ); regex_search(str, rex); assert( i.get() == 2 );
![]() |
Note |
---|---|
As the name "local" suggests, |
local
public member functionslocal();Store a default-constructed value of type
T
. explicit local(T const & t);Store a default-constructed value of type
T
.
Parameters: |
|
T & get();Fetch the wrapped value.
T const & get() const;This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.