std::regex_traits<CharT>::length
來自 cppreference.com
< cpp | regex | regex_traits
static std::size_t length( const char_type* p ); |
||
計算以空字元結尾的字元序列的長度,即最小的 i
,使得 p[i] == 0。
std::regex_traits 的標準庫特化會執行 std::char_traits<CharT>::length(p);。
[編輯] 引數
p | - | 指向以空字元結尾的字元序列的第一個元素的指標 |
[編輯] 返回值
以空字元結尾的字串的長度。
[編輯] 示例
執行此程式碼
#include <iostream> #include <regex> int main() { std::cout << std::regex_traits<char>::length("Кошка") << '\n' << std::regex_traits<wchar_t>::length(L"Кошка") << '\n'; }
輸出
10 5