scan_not
描述 (Description)
它返回不在类别中的第一个字符,并返回[low,high]范围内的第一个字符,该字符不会分类为m中指定的任何类别。 如果在范围内找不到这样的字符,则返回高。
声明 (Declaration)
以下是std :: ctype :: scan_not的声明。
C++98
const char_type* scan_not (mask m, const char_type* low, const char_type* high) const;
C++11
const char_type* scan_not (mask m, const char_type* low, const char_type* high) const;
参数 (Parameters)
m - 它是成员类型掩码的位掩码。
low,high - 它是指向字符序列的开头和结尾的指针。
返回值 (Return Value)
它返回指向分类范围中第一个元素的指针,如果没有找到则返回高。
异常 (Exceptions)
Strong guarantee - 如果抛出异常,则没有任何影响。
数据竞争 (Data races)
访问该对象以及[低,高]范围内的元素。
例子 (Example)
在下面的例子中解释了std :: ctype :: scan_not。
#include <iostream>
#include <locale>
int main () {
std::locale loc;
const char period[] = "june2018";
const char * p = std::use_facet< std::ctype<char> >(loc).scan_not
( std::ctype<char>::alpha, period, period+12 );
std::cout << "The first non-alphabetic character is: " << *p << '\n';
return 0;
}
让我们编译并运行上面的程序,这将产生以下结果 -
The first non-alphabetic character is: 2