Home | Libraries | People | FAQ | More |
boost::xpressive::sub_match — Class template sub_match denotes the sequence of characters matched by a particular marked sub-expression.
// In header: <boost/xpressive/sub_match.hpp> template<typename BidiIter> struct sub_match : public std::pair< BidiIter, BidiIter > { // types typedef iterator_value< BidiIter >::type value_type; typedef iterator_difference< BidiIter >::type difference_type; typedef unspecified string_type; typedef BidiIter iterator; // construct/copy/destruct sub_match(); sub_match(BidiIter, BidiIter, bool = false); // public member functions string_type str() const; operator string_type() const; difference_type length() const; operator bool_type() const; bool operator!() const; int compare(string_type const &) const; int compare(sub_match const &) const; int compare(value_type const *) const; // public data members bool matched; // true if this sub-match participated in the full match. };
When the marked sub-expression denoted by an object of type sub_match<> participated in a regular expression match then member matched evaluates to true, and members first and second denote the range of characters [first,second) which formed that match. Otherwise matched is false, and members first and second contained undefined values.
If an object of type sub_match<> represents sub-expression 0 - that is to say the whole match - then member matched is always true, unless a partial match was obtained as a result of the flag match_partial being passed to a regular expression algorithm, in which case member matched is false, and members first and second represent the character range that formed the partial match.
sub_match
public member functionsstring_type str() const;
operator string_type() const;
difference_type length() const;
operator bool_type() const;
bool operator!() const;
int compare(string_type const & str) const;Performs a lexicographic string comparison.
Parameters: |
|
||
Returns: |
the results of (*this).str().compare(str) |
int compare(sub_match const & sub) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
int compare(value_type const * ptr) const;
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.