std:: regex_traits
|
定义于头文件
<regex>
|
||
|
template
<
class
CharT
>
class regex_traits ; |
(C++11 起) | |
类型特征模板
regex_traits
为
std::basic_regex
提供操作
CharT
类型所需的一系列类型和函数。
由于许多正则表达式操作具有区域设置敏感性(当设置了 std::regex_constants::collate 标志时),regex_traits 类通常会将 std::locale 的实例作为私有成员持有。
标准特化
标准库定义了两个
std::regex_traits
的特化版本:
std::regex_traits<char>
|
|
std::regex_traits<wchar_t>
|
这些特化使得可以使用 std:: basic_regex < char > (即 std::regex )和 std:: basic_regex < wchar_t > (即 std::wregex )。若要将 std::basic_regex 用于其他字符类型(例如 char32_t ),则必须使用用户提供的特征类。
成员类型
| 类型 | 定义 |
char_type
|
CharT
|
string_type
|
std:: basic_string < CharT > |
locale_type
|
用于正则表达式中本地化行为的区域设置。必须满足 CopyConstructible 要求 |
char_class_type
|
表示字符分类,能够容纳由
lookup_classname
返回的实现特定集合。必须是
BitmaskType
类型。
|
成员函数
|
构造 regex_traits 对象
(公开成员函数) |
|
|
[static]
|
计算以空字符结尾的字符串的长度
(公开静态成员函数) |
|
确定字符的等价键
(公开成员函数) |
|
|
确定字符的忽略大小写等价键
(公开成员函数) |
|
|
确定给定字符串的排序键,用于提供排序顺序
(公开成员函数) |
|
|
确定字符序列的主排序键,用于确定等价类
(公开成员函数) |
|
|
通过名称获取排序元素
(公开成员函数) |
|
|
通过名称获取字符类
(公开成员函数) |
|
|
指示是否属于本地化字符类
(公开成员函数) |
|
|
将表示数字的字符转换为整数值
(公开成员函数) |
|
|
设置本地化环境
(公开成员函数) |
|
|
获取本地化环境
(公开成员函数) |