Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.
PrevUpHomeNext

Function template as_xpr

boost::xpressive::as_xpr — Makes a literal into a regular expression.

Synopsis

// In header: <boost/xpressive/regex_primitives.hpp>


template<typename Literal> unspecified as_xpr(Literal const & literal);

Description

Use as_xpr() to turn a literal into a regular expression. For instance, "foo" >> "bar" will not compile because both operands to the right-shift operator are const char*, and no such operator exists. Use as_xpr("foo") >> "bar" instead.

You can use as_xpr() with character literals in addition to string literals. For instance, as_xpr('a') will match an 'a'. You can also complement a character literal, as with ~as_xpr('a'). This will match any one character that is not an 'a'.


PrevUpHomeNext