std::max

Defined in header <algorithm> (1) template< class T > const T& max( const T& a, const T& b ); (until C++14) template< class T > constexpr const T& max( const T& a, const T& b ); (since C++14) (2) template< class T, class Compare > const T& max( const T& a, const T& b, Compare comp ); (until C++14) template< class T, class Compare > constexpr const T& max( const T& a, const T& b, Compare co

std::match_results::str

string_type str( size_type n = 0 ) const; (since C++11) Returns a string representing the indicated sub-match. If n == 0, a string representing entire matched expression is returned. If n > 0 && n < size(), a string representing nth sub-match is returned. if n >= size(), a string representing the unmatched match is returned. The call is equivalent to string_type((*this)[n]); Parameters n - integral number specifying which match to return Return value Retur

std::match_results::swap

void swap( match_results& other ); (since C++11) Exchanges the shared states of two match_results objects. Parameters other - the match_results to swap with Return value (none). Exceptions noexcept specification: noexcept Example See also std::swap(std::match_results) (C++11) specializes the std::swap() algorithm (function template)

std::match_results::size

size_type size() const; (since C++11) Returns the number of submatches, i.e. std::distance(begin(), end()). Parameters (none). Return value The number of submatches. Exceptions noexcept specification: noexcept Complexity Constant. See also Example #include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a)*b"); std::string target("aaab"); std::smatch sm; std::regex_match(target, sm, re); std::cou

std::match_results::length

difference_type length( size_type n = 0 ) const; (since C++11) Returns the length of the specified sub-match. If n == 0, the length of the entire matched expression is returned. If n > 0 && n < size(), the length of nth sub-match is returned. if n >= size(), a length of the unmatched match is returned. The call is equivalent to (*this)[n].length(). Parameters n - integral number specifying which match to examine Return value The length of the specified mat

std::match_results::prefix

const_reference prefix() const; (since C++11) Obtains a reference to the std::sub_match object representing the target sequence between the start of the beginning of the target sequence and the start of the entire match of the regular expression. The behavior is undefined unless ready() == true. Parameters (none). Return value Reference to the unmatched prefix. Example #include <iostream> #include <regex> #include <string> int main() { std::regex re("a(a

std::match_results::max_size

size_type max_size() const; (since C++11) Returns the maximum number of submatches the match_results type is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest number of submatches. Parameters (none). Return value Maximum number of submatches. Exceptions noexcept specification: noexcept Complexity Constant.

std::match_results::get_allocator

allocator_type get_allocator() const; (since C++11) Returns the allocator associated with the object. Parameters (none). Return value The associated allocator. Complexity Constant.

std::match_results::ready

bool ready() const; (since C++11) Indicates if the match results are ready (valid) or not. A default-constructed match result has no result state (is not ready), and can only be made ready by one of the regex algorithms. The ready state implies that all match results have been fully established. The result of calling most member functions of the match_results object that is not ready is undefined. Return value true if the match results are ready, false otherwise. Example #includ

std::match_results::operator[]

const_reference operator[]( size_type n ) const; (since C++11) If n > 0 and n < size(), returns a reference to the std::sub_match representing the part of the target sequence that was matched by the nth captured marked subexpression). If n == 0, returns a reference to the std::sub_match representing the part of the target sequence matched by the entire matched regular expression. if n >= size(), returns a reference to a std::sub_match representing an unmatched sub-expression (a