boost::xpressive::local — local<>
是一个针对存储在 local 内部的值的引用的惰性包装器。它用于 xpressive 语义动作中。
// 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; };
以下是如何在语义动作中使用 local<>
的示例。
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 );
![]() |
注意 |
---|---|
正如“local”这个名称所暗示的那样, |