Namespaces
Variants

std::ctype<CharT>:: scan_not, std::ctype<CharT>:: do_scan_not

From cppreference.net
ヘッダーで定義 <locale>
public :
const CharT * scan_not ( mask m, const CharT * beg, const CharT * end ) const ;
(1)
protected :
virtual const CharT * do_scan_not ( mask m, const CharT * beg, const CharT * end ) const ;
(2)
1) パブリックメンバー関数。最も派生したクラスの保護された仮想メンバー関数 do_scan_not を呼び出します。
2) 文字配列 [ beg , end ) 内で分類マスク m を満たさない最初の文字を検索します。つまり、 c is ( m, c ) によって false を返す最初の文字です。

目次

パラメータ

m - 検索対象のマスク
beg - 検索対象の文字配列の先頭文字へのポインタ
end - 検索対象の文字配列の終端の次を指すポインタ

戻り値

マスクを満たさない最初の文字へのポインタ。 [ beg , end ) の範囲内で、そのような文字が見つからない場合は end を返す。

#include <clocale>
#include <iostream>
#include <iterator>
#include <locale>
int main()
{
    std::setlocale(LC_ALL, "en_US.utf8");
    std::wcout.imbue(std::locale("en_US.utf8"));
    auto& f = std::use_facet<std::ctype<wchar_t>>(std::wcout.getloc());
    // 先頭の空白をスキップ
    wchar_t s1[] = L"      \t\t\n  Кошка";
    const wchar_t* p1 = f.scan_not(std::ctype_base::space, std::begin(s1), std::end(s1));
    std::wcout << '\'' << p1 << "'\n";
    // 先頭の数字をスキップ
    wchar_t s2[] = L"123456789ネプネプ";
    const wchar_t* p2 = f.scan_not(std::ctype_base::digit, std::begin(s2), std::end(s2));
    std::wcout << '\'' << p2 << "'\n";
}

出力:

'Кошка'
'ネプネプ'

関連項目

分類テーブルを使用して、指定された分類に適合しないシーケンス内の最初の文字を特定する
( std::ctype <char> のpublicメンバー関数)
[virtual]
指定された分類に適合するシーケンス内の最初の文字を特定する
(仮想protectedメンバー関数)