Struct template local
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.
Synopsis
template<typename T>
struct local : public proto::terminal::type< reference_wrapper< T > > {
local();
explicit local(T const &);
T & get();
T const & get() const;
};
Description
Ниже приведен пример того, как использовать<local<>
>в семантических действиях.
using namespace boost::xpressive;
local<int> i(0);
std::string str("1!2!3?");
sregex rex = +( _d [ ++i ] >> '!' );
regex_search(str, rex);
assert( i.get() == 2 );
![[Note]](/img/note.png) | Note |
---|
Как следует из названия «местный»,<local<> >объекты и относящиеся к ним регексы никогда не должны покидать местный охват. Значение, хранящееся в локальном объекте, будет уничтожено в конце<local<>'s >жизни, и любые объекты регекса, все еще удерживающие<local<> >, будут оставлены с висящей ссылкой. |
Template Parameters
Локальный перевод.
[ORIG_END] -->
local
public
construct/copy/destruct
- <
local();
>Сохранить построенное по умолчанию значение типа<T
>.