std::regex_traits::regex_traits

regex_traits(); Default-constructs the std::regex_traits object, including default-constructing the private std::locale member or any other internal state as necessary. Parameters (none). Return value (none). Example #include <iostream> #include <regex> int main() { std::locale::global(std::locale("en_US.utf8")); std::regex_traits<char> r1; std::regex_traits<wchar_t> r2; std::cout << "The regex locale is " << r1.getloc().n

std::regex_traits::lookup_classname

template< class ForwardIt > char_class_type lookup_classname( ForwardIt first, ForwardIt last, bool icase = false ) const; If the character sequence [first, last) represents the name of a valid character class in the currently imbued locale (that is, the string between [: and :] in regular expressions), returns the implementation-defined value representing this character class. Otherwise, returns zero. If the para

std::regex_traits::transform

template< class ForwardIt > string_type transform( ForwardIt first, ForwardIt last) const; Obtains the sort key for the character sequence [first, last), such that if a sort key compares less than another sort key with operator<, then the character sequence that produced the first sort key comes before the character sequence that produced the second sort key, in the currently imbued locale's collation order. For example when the regex flag std::regex_constants::collate is set,

std::regex_traits::lookup_collatename

template< class ForwardIt > string_type lookup_collatename( ForwardIt first, ForwardIt last ) const; If the character sequence [first, last) represents the name of a valid collating element in the currently imbued locale, returns the name of that collating element. Otherwise, returns an empty string. Collating elements are the symbols found in POSIX regular expressions between [. and .]. For example, [.a.] matches the character a in the C locale. [.tilde.] matches the character ~

std::regex_traits::isctype

bool isctype( CharT c, char_class_type f ) const; Determines whether the character c belongs to the character class identified by f, which, in turn, is a value returned by lookup_classname() or a bitwise OR of several such values. The version of this function provided in the standard library specializations of std::regex_traits does the following: 1) First converts f to some temporary value m of type std::ctype_base::mask in implementation-defined manner 2) Then attempts to classify t

std::regex_traits

Defined in header <regex> template< class CharT > class regex_traits; (since C++11) The type trait template regex_traits supplies std::basic_regex with the set of types and functions necessary to operate on the type CharT. Since many of regex operations are locale-sensitive (when std::regex_constants::collate flag is set), the regex_traits class typically holds an instance of a std::locale as a private member. Standard specializations Two specializations of std::re

std::regex_traits::length

static std::size_t length(const char_type* p); Calculates the length of a null-terminated character sequence, that is, the smallest i such that p[i]==0. Standard library specializations of std::regex_traits execute std::char_traits<CharT>::length(p); Parameters p - pointer to the first element of the null-terminated character sequence Return value The length of the null-terminated character string. Example #include <regex> #include <iostream> int m

std::regex_traits::imbue

locale_type imbue( locale_type loc ); (since C++11) Replaces the current locale with a copy of loc. If loc is different than the current locale, then all cached data is invalidated. After the call getloc() == loc. Parameters loc - the locale to imbue Return value The current locale of the traits object. If imbue() has been never called for this object, then the global locale at the time of the call is returned. Otherwise, the locale passed to the last call to imbue() is re

std::regex_traits::getloc

locale_type getloc() const; (since C++11) Returns the current locale of the traits object. If imbue() has been never called for this object, then the global locale at the time of the call is returned. Otherwise, the locale passed to the last call to imbue() is returned. Parameters (none). Return value The current locale of the traits object. Example See also imbue sets the locale (public member function)

std::regex_token_iterator

Defined in header <regex> template< class BidirIt, class CharT = typename std::iterator_traits<BidirIt>::value_type, class Traits = std::regex_traits<CharT> > class regex_token_iterator (since C++11) std::regex_token_iterator is a read-only ForwardIterator that accesses the individual sub-matches of every match of a regular expression within the underlying character sequence. It can also be used to access the parts of the sequence that were not