Namespaces
Variants

std::ctype<CharT>:: scan_is, std::ctype<CharT>:: do_scan_is

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

目次

パラメータ

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_is(std::ctype_base::alpha, std::begin(s1), std::end(s1));
    std::wcout << '\'' << p1 << "'\n";
    // 最初の文字までスキップ
    wchar_t s2[] = L"123456789ネプネプ";
    const wchar_t* p2 = f.scan_is(std::ctype_base::alpha, std::begin(s2), std::end(s2));
    std::wcout << '\'' << p2 << "'\n";
}

出力:

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

不具合報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 152 C++98 do_scan_is の効果として is ( m ) が言及されていた
しかし is にはそのようなオーバーロードが存在しない
is ( m, c ) に修正

関連項目

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