首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::collate_byname

Defined in header <locale>

template< class CharT > class collate_byname : public std::collate<CharT>;

std::collate_bynamestd::collate方面,它封装了特定于地区的排序规则%28比较%29和字符串的散列。就像std::collate,它可以被注入std::regex并适用于,通过...std::locale::operator(),直接指向所有期望字符串比较谓词的标准算法。

标准库提供了两个专门化。

在标头中定义<locale>

*。

STD:校对[医]名名<char>特定于地区的多字节字符串排序规则

STD:校对[医]名<wchar[医]T>特定于区域设置的宽字符串排序规则

成员函数

(constructor)

constructs a new collate_byname facet (public member function)

(destructor)

destroys a collate_byname facet (protected member function)

STD:校对[医]名称::[医]名名

explicit collate_byname( const char* name, std::size_t refs = 0 );

explicit collate_byname( const std::string& name, std::size_t refs = 0 );

(since C++11)

构造一个新的std::collate_byname区域设置的方面name...

refs用于资源管理:如果refs == 0时,该实现破坏了面。std::locale保存它的对象被销毁。否则,该对象不会被销毁。

参数

name

-

the name of the locale

refs

-

the number of references that link to the facet

STD:校对[医]名称::~校对[医]名名

protected: ~collate_byname();

摧毁了这个面。

继承自STD:校对

成员类型

Member type

Definition

char_type

charT

string_type

std::basic_string<charT>

成员函数

compare

invokes do_compare (public member function of std::collate)

transform

invokes do_transform (public member function of std::collate)

hash

invokes do_hash (public member function of std::collate)

受保护成员函数

do_compare virtual

compares two strings using this facet's collation rules (virtual protected member function of std::collate)

do_transform virtual

transforms a string so that collation can be replaced by comparison (virtual protected member function of std::collate)

do_hash virtual

generates an integer hash value using this facet's collation rules (virtual protected member function of std::collate)

注记

排序顺序是字典顺序:字母在国家字母中的位置等价类%29比它的情况或变体有更高的优先级。在等价类中,小写字符在大写等价物和特定于地区的顺序之前进行排序,可以适用于具有对话式的字符。在某些地区,一组字符比较起来是单个的。校对单位例如,"ch"捷克文如下"h"先于"i",和"dzs"匈牙利文如下"dz"先于"g"...

另见

collate

defines lexicographical comparison and hashing of strings (class template)

strcoll

compares two strings in accordance to the current locale (function)

wcscoll

compares two wide strings in accordance to the current locale (function)

operator()

lexicographically compares two strings using this locale's collate facet (public member function of std::locale)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券