std::regex_traits
From cppreference.com
C++
Feature test macros (C++20)
Concepts library (C++20)
Metaprogramming library (C++11)
Ranges library (C++20)
Filesystem library (C++17)
Concurrency support library (C++11)
Execution control library (C++26)
Text processing library
Regular expressions library (C++11)
Formatting library (C++20)
(C++17)
(C++17)
(C++17)
(C++17)
(C++17)
(C++26)
Regular expressions library
Classes
(C++11)
(C++11)
(C++11)
Algorithms
(C++11)
(C++11)
(C++11)
Iterators
(C++11)
(C++11)
Exceptions
(C++11)
Traits
regex_traits
(C++11)
Constants
(C++11)
(C++11)
(C++11)
Regex Grammar
(C++11)
std::regex_traits
Member functions
Defined in header
<regex>
template< class CharT >
class regex_traits;
(since C++11)
class regex_traits;
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.
[edit] Standard specializations
Two specializations of std::regex_traits
are defined by the standard library:
std::regex_traits<char>
std::regex_traits<wchar_t>
These specializations make it possible to use std::basic_regex <char> (aka std::regex ) and std::basic_regex <wchar_t> (aka std::wregex ). To use std::basic_regex with other character types (for example, char32_t), a user-provided trait class must be used.
[edit] Member types
Type
Definition
char_type
CharT
string_type
std::basic_string <CharT>
locale_type
The locale used for localized behavior in the regular expression. Must be CopyConstructible
char_class_type
Represents a character classification and is capable of holding an implementation specific set returned by lookup_classname
. Must be a BitmaskType.
[edit] Member functions
[static]
(public static member function) [edit]
determines the sort key for the given string, used to provide collation order
(public member function) [edit]
(public member function) [edit]
determines the primary sort key for the character sequence, used to determine equivalence class
(public member function) [edit]
(public member function) [edit]
translates the character representing a numeric digit into an integral value
(public member function) [edit]
(public member function) [edit]