cppreference.comやcpprefjpを見る限り、search系関数のnoexcept指定は例えばfind_first_of
だと
cpp
1constexpr size_type find_first_of(basic_string_view sv, size_type pos = 0) const noexcept; // (1) 2constexpr size_type find_first_of(CharT c, size_type pos = 0) const noexcept; // (2) 3constexpr size_type find_first_of(const CharT* s, size_type pos, size_type n) const; // (3) 4constexpr size_type find_first_of(const CharT* s, size_type pos = 0) const; // (4)
のようになっています。ここで規格書(N4659)によれば
3 Each member function of the form
constexpr return-type F (const charT* s, size_type pos);
is equivalent to return F (basic_string_view(s), pos);
4 Each member function of the form
constexpr return-type F (const charT* s, size_type pos, size_type n);
is equivalent to return F (basic_string_view(s, n), pos);
5 Each member function of the form
constexpr return-type F (charT c, size_type pos);
is equivalent to return F (basic_string_view(&c, 1), pos);
となっており、例えばfind_first_of
だと
cpp
1constexpr size_type find_first_of(basic_string_view str, size_type pos = 0) const noexcept;
のように記述されています。つまりconst noexcept
がついています。
is equivalent to
をまっとうに解釈すれば、冒頭のは
cpp
1constexpr size_type find_first_of(basic_string_view sv, size_type pos = 0) const noexcept; // (1) 2constexpr size_type find_first_of(CharT c, size_type pos = 0) const noexcept; // (2) 3constexpr size_type find_first_of(const CharT* s, size_type pos, size_type n) const noexcept; // (3) 4constexpr size_type find_first_of(const CharT* s, size_type pos = 0) const noexcept; // (4)
であるべきではないかと思うのですが、なにか解釈を間違えているでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/06/01 09:25
2018/06/01 09:42
2018/06/01 16:33