22.10.18 Searchers [func.search] C++N4910:2022 (628) p761.cpp

# はじめに(Introduction)

N4910  Working Draft, Standard for Programming Language C++

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf

n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 WG21では、可能な限り作業文書を公開し、幅広い意見を求めています。
一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, TOPPERSカーネル、g++(GCC), clang++(LLVM）との関係も調査中です。
何か、抜け漏れ、耳より情報がありましたらおしらせくださると幸いです。

 <この項は書きかけです。順次追記します。>

## 背景(back ground)
C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに１回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。

この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を１０種類以上、最近になって解決できたことがあります。それは、主に次の３つの情報に基づいています。

https://stackoverflow.com

http://ja.cppreference.com/

cpprefjp - C++日本語リファレンス

https://cpprefjp.github.io/

コンパイラの実装状況

https://cpprefjp.github.io/implementation-status.html

また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。

## 作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの２種類
でコンパイルし、

１）コンパイルエラーを収集する。
２）コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
３）リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
４）意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。

１）だけのものから４）まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。

### C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list  

https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

### C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
https://qiita.com/kaizen_nagoya/items/3294c014044550896010

### C++N4606, 2016符号断片編纂一覧(example code compile list)
C++N4606, 2016 Working Draft 2016, ISO/IEC 14882, C++ standard(1) Example code compile list
https://qiita.com/kaizen_nagoya/items/df5d62c35bd6ed1c3d43/

### C++N3242, 2011 sample code compile list on clang++ and g++
https://qiita.com/kaizen_nagoya/items/685b5c1a2c17c1bf1318

## 編纂器(Compiler)
### clang++ --version
> Debian clang version 14.0.5-++20220610033153+c12386ae247c-1~exp1~20220610153237.151
Target: x86_64-pc-linux-gnu, Thread model: posix, InstalledDir: /usr/bin

### g++- --version
> g++ (GCC) 12.1.0  Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

# 22.10.18 Searchers [func.search] C++N4910:2022 (628) p761.cpp

## 算譜(source code)

```c++:p761.cpp
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "22.10.18 Searchers [func.search] C++N4910:2022 (628) p761.cpp";
// Debian clang version 14.0.5-++20220610033153+c12386ae247c-
// g++ (GCC) 12.1.0 Copyright (C) 2022 Free Software Foundation, Inc.
// Edited by Dr. OGAWA Kiyoshi. Compile procedure and results record.
// C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
// https://qiita.com/kaizen_nagoya/items/fc957ddddd402004bb91

#include "N4910.h"

using namespace std;

// 22.10.18.1 General [func.search.general]
//  Subclause 22.10.18 provides function object types (22.10) for operations that search for a sequence [pat_first, pat_last) in another sequence [first, last) that is provided to the object’s function call operator. The first sequence (the pattern to be searched for) is provided to the object’s constructor, and the second (the sequence to be searched) is provided to the function call operator.
//  Each specialization of a class template specified in 22.10.18 shall meet the Cpp17CopyConstructible and Cpp17CopyAssignable requirements. // Template parameters named
// — ForwardIterator,
// — ForwardIterator1,
// — ForwardIterator2,
// — RandomAccessIterator,
// — RandomAccessIterator1,
// — RandomAccessIterator2, and — BinaryPredicate
//  The Boyer-Moore searcher implements the Boyer-Moore search algorithm. The Boyer-Moore-Horspool searcher implements the Boyer-Moore-Horspool search algorithm. In general, the Boyer-Moore searcher will use more memory and give better runtime performance than Boyer-Moore-Horspool.
// of templates specified in 22.10.18 shall meet the same requirements and semantics as specified in 27.1. Template parameters named Hash shall meet the Cpp17Hash requirements (Table 36).
// 22.10.18.2 Class template default_searcher [func.search.default]
namespace std {
template<class ForwardIterator1, class BinaryPredicate = equal_to<>>
class default_searcher {
public:
    constexpr default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
                               BinaryPredicate pred = BinaryPredicate());
    template<class ForwardIterator2>
    constexpr pair<ForwardIterator2, ForwardIterator2>
    operator()(ForwardIterator2 first, ForwardIterator2 last) const;
private:
    ForwardIterator1 pat_first_;
    ForwardIterator1 pat_last_;
    BinaryPredicate pred_;
};
}
// exposition only // exposition only // exposition only
constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
                           BinaryPredicate pred = BinaryPredicate());
// Effects: Constructs a default_searcher object, initializing pat_first_ with pat_first, pat_last_ with pat_last, and pred_ with pred.
// Throws: Any exception thrown by the copy constructor of BinaryPredicate or ForwardIterator1.
template<class ForwardIterator2>
constexpr pair<ForwardIterator2, ForwardIterator2>
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
// Effects: Returns a pair of iterators i and j such that
// — i == search(first, last, pat_first_, pat_last_, pred_), and
// — if i == last, then j == last, otherwise j == next(i, distance(pat_first_, pat_last_)).
// 22.10.18.3 Class template boyer_moore_searcher [func.search.bm]
namespace std {
template<class RandomAccessIterator1,
         class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
         class BinaryPredicate = equal_to<>>
class boyer_moore_searcher {
public:
    boyer_moore_searcher(RandomAccessIterator1 pat_first,
                         RandomAccessIterator1 pat_last,
                         Hash hf = Hash(),
                         BinaryPredicate pred = BinaryPredicate());
    template<class RandomAccessIterator2>
    pair<RandomAccessIterator2, RandomAccessIterator2>
    operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
private:
    RandomAccessIterator1 pat_first_;
    RandomAccessIterator1 pat_last_;
    Hash hash_;
    BinaryPredicate pred_;
};
}
// exposition // exposition // exposition // exposition
only only only only
boyer_moore_searcher(RandomAccessIterator1 pat_first,
                     RandomAccessIterator1 pat_last,
                     Hash hf = Hash(),
                     BinaryPredicate pred = BinaryPredicate());
// Preconditions: The value type of RandomAccessIterator1 meets the Cpp17DefaultConstructible, the Cpp17CopyConstructible, and the Cpp17CopyAssignable requirements.
// Let V be iterator_traits<RandomAccessIterator1>::value_type. For any two values A and B of type V, if pred(A, B) == true, then hf(A) == hf(B) is true.
// Effects: Initializes pat_first_ with pat_first, pat_last_ with pat_last, hash_ with hf, and pred_- with pred.
// Throws: Any exception thrown by the copy constructor of RandomAccessIterator1, or by the default constructor, copy constructor, or the copy assignment operator of the value type of RandomAccess- Iterator1, or the copy constructor or operator() of BinaryPredicate or Hash. May throw bad_alloc if additional memory needed for internal data structures cannot be allocated.
// Preconditions: The value type of RandomAccessIterator1 meets the Cpp17DefaultConstructible, Cpp17CopyConstructible, and Cpp17CopyAssignable requirements.
template<class RandomAccessIterator2>
pair<RandomAccessIterator2, RandomAccessIterator2>
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
// Mandates: RandomAccessIterator1 and RandomAccessIterator2 have the same value type. Effects: Finds a subsequence of equal values in a sequence.
// Returns: A pair of iterators i and j such that
i// — i is the first iterator in the range [first,last - (pat_last_ - pat_first_)) such that for every non-negative integer n less than pat_last_ - pat_first_ the following condition holds: pred(*(i + n), *(pat_first_ + n)) != false, and
// — j == next(i, distance(pat_first_, pat_last_)). Returns make_pair(first, first) if [pat_first_, pat_last_) is empty, otherwise returns make_- pair(last, last) if no such iterator is found.
// Complexity: At most (last - first) * (pat_last_ - pat_first_) applications of the predicate.
// 22.10.18.4 Class template boyer_moore_horspool_searcher [func.search.bmh]
namespace std {
template<class RandomAccessIterator1,
         class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
         class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher {
public:
    boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
                                  RandomAccessIterator1 pat_last,
                                  Hash hf = Hash(),
                                  BinaryPredicate pred = BinaryPredicate());
    template<class RandomAccessIterator2>
    pair<RandomAccessIterator2, RandomAccessIterator2>
    operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
private:
    RandomAccessIterator1 pat_first_;
    RandomAccessIterator1 pat_last_;
    Hash hash_;
    BinaryPredicate pred_;
};
}
// exposition only // exposition only // exposition only // exposition only
boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
                              RandomAccessIterator1 pat_last,
                              Hash hf = Hash(),
                              BinaryPredicate pred = BinaryPredicate());
// Let V be iterator_traits<RandomAccessIterator1>::value_type. For any two values A and B of type V, if pred(A, B) == true, then hf(A) == hf(B) is true.
// Effects: Initializes pat_first_ with pat_first, pat_last_ with pat_last, hash_ with hf, and pred_- with pred.
// Throws: Any exception thrown by the copy constructor of RandomAccessIterator1, or by the default constructor, copy constructor, or the copy assignment operator of the value type of RandomAccess- Iterator1, or the copy constructor or operator() of BinaryPredicate or Hash. May throw bad_alloc if additional memory needed for internal data structures cannot be allocated.
// — meet the Cpp17Hash requirements (Table 36), with Key as the function call argument type, the Cpp17DefaultConstructible requirements (Table 29), the Cpp17CopyAssignable requirements (Table 33),
// — be swappable (16.4.4.3) for lvalues,
// — meet the requirement that if k1 == k2 is true, h(k1) == h(k2) is also true, where h is an object of type hash<Key> and k1 and k2 are objects of type Key;
// — meet the requirement that the expression h(k), where h is an object of type hash<Key> and k is an object of type Key, shall not throw an exception unless hash<Key> is a program-defined specialization.
template<class RandomAccessIterator2>
pair<RandomAccessIterator2, RandomAccessIterator2>
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
// Mandates: RandomAccessIterator1 and RandomAccessIterator2 have the same value type. Effects: Finds a subsequence of equal values in a sequence.
// Returns: A pair of iterators i and j such that
// — i is the first iterator in the range [first,last - (pat_last_ - pat_first_)) such that for every non-negative integer n less than pat_last_ - pat_first_ the following condition holds: pred(*(i + n), *(pat_first_ + n)) != false, and
// — j == next(i, distance(pat_first_, pat_last_)).
// Returns make_pair(first, first) if [pat_first_, pat_last_) is empty, otherwise returns make_- pair(last, last) if no such iterator is found.
// Complexity: At most (last - first) * (pat_last_ - pat_first_) applications of the predicate.
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}
```

## 編纂・実行結果(compile and go)

```ubuntu:bash
$ clang++ p761.cpp -std=03 -o p761l -I. -Wall
In file included from p761.cpp:10:
In file included from ./N4910.h:11:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/atomic:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/c++0x_warning.h:32:2: error: This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
 ^
p761.cpp:27:71: error: a space is required between consecutive right angle brackets (use '> >')
    template<class ForwardIterator1, class BinaryPredicate = equal_to<>>
                                                                      ^~
                                                                      > >
p761.cpp:27:62: error: too few template arguments for class template 'equal_to'
    template<class ForwardIterator1, class BinaryPredicate = equal_to<>>
                                                             ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_function.h:351:12: note: template is declared here
    struct equal_to : public binary_function<_Tp, _Tp, bool>
           ^
p761.cpp:30:1: error: unknown type name 'constexpr'
constexpr default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
^
p761.cpp:30:11: error: constructor cannot have a return type
constexpr default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
          ^~~~~~~~~~~~~~~~
p761.cpp:33:3: error: unknown type name 'constexpr'
  constexpr pair<ForwardIterator2, ForwardIterator2>
  ^
p761.cpp:33:13: error: member 'pair' declared as a template
  constexpr pair<ForwardIterator2, ForwardIterator2>
            ^
p761.cpp:33:53: error: expected ';' at end of declaration list
  constexpr pair<ForwardIterator2, ForwardIterator2>
                                                    ^
                                                    ;
p761.cpp:41:6: error: unknown type name 'constexpr'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
     ^
p761.cpp:41:33: error: unknown type name 'ForwardIterator'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
                                ^
p761.cpp:41:60: error: unknown type name 'ForwardIterator'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
                                                           ^
p761.cpp:42:33: error: unknown type name 'BinaryPredicate'
                                BinaryPredicate pred = BinaryPredicate());
                                ^
p761.cpp:42:56: error: use of undeclared identifier 'BinaryPredicate'
                                BinaryPredicate pred = BinaryPredicate());
                                                       ^
p761.cpp:46:3: error: unknown type name 'constexpr'
  constexpr pair<ForwardIterator2, ForwardIterator2>
  ^
p761.cpp:46:13: error: no variable template matches partial specialization
  constexpr pair<ForwardIterator2, ForwardIterator2>
            ^
p761.cpp:46:53: error: expected ';' at end of declaration
  constexpr pair<ForwardIterator2, ForwardIterator2>
                                                    ^
                                                    ;
p761.cpp:47:12: error: unknown type name 'ForwardIterator2'
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
           ^
p761.cpp:47:36: error: unknown type name 'ForwardIterator2'
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
                                   ^
p761.cpp:47:1: error: C++ requires a type specifier for all declarations
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p761.cpp -std=2b -o p761l -I. -Wall
p761.cpp:41:33: error: unknown type name 'ForwardIterator'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
                                ^
p761.cpp:41:60: error: unknown type name 'ForwardIterator'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
                                                           ^
p761.cpp:42:33: error: unknown type name 'BinaryPredicate'
                                BinaryPredicate pred = BinaryPredicate());
                                ^
p761.cpp:42:56: error: use of undeclared identifier 'BinaryPredicate'
                                BinaryPredicate pred = BinaryPredicate());
                                                       ^
p761.cpp:41:16: error: deduction guide must be declared in the same scope as template 'std::default_searcher'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
               ^
p761.cpp:28:11: note: template is declared here
    class default_searcher {
          ^
p761.cpp:41:16: error: deduction guide cannot be declared 'constexpr'
     constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
     ~~~~~~~~~ ^
p761.cpp:41:16: error: deduction guide declaration without trailing return type
p761.cpp:47:59: error: non-member function cannot have 'const' qualifier
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
                                                          ^~~~~
p761.cpp:47:1: error: overloaded 'operator()' must be a non-static member function
operator()(ForwardIterator2 first, ForwardIterator2 last) const;
^
p761.cpp:72:1: error: unknown type name 'only'
only only only only
^
p761.cpp:72:10: error: expected ';' after top level declarator
only only only only
         ^
         ;
p761.cpp:84:69: error: non-member function cannot have 'const' qualifier
operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
                                                                    ^~~~~
p761.cpp:87:1: error: unknown type name 'i'
i// — i is the first iterator in the range [first,last - (pat_last_ - pat_first_)) such that for every non-negative integer n less than pat_last_ - pat_first_ the following condition holds: pred(*(i + n), *(pat_first_ + n)) != false, and
^
p761.cpp:91:3: error: expected unqualified-id
  namespace std {
  ^
p761.cpp:111:31: error: unknown type name 'RandomAccessIterator1'
boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
                              ^
p761.cpp:112:31: error: unknown type name 'RandomAccessIterator1'
                              RandomAccessIterator1 pat_last,
                              ^
p761.cpp:113:10: error: unknown type name 'Hash'
                              Hash hf = Hash(),
                              ^
p761.cpp:113:20: error: use of undeclared identifier 'Hash'
                              Hash hf = Hash(),
                                        ^
p761.cpp:114:26: error: unknown type name 'BinaryPredicate'
                         BinaryPredicate pred = BinaryPredicate());
                         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p761.cpp -std=03 -o p761g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p761.cpp:10:
/usr/local/include/c++/12.1.0/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
   32 | #error This file requires compiler and library support \
      |  ^~~~~
p761.cpp:30:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   30 | constexpr default_searcher(ForwardIterator1 pat_first, ForwardIterator1 pat_last,
      | ^~~~~~~~~
p761.cpp:27:71: error: spurious '>>', use '>' to terminate a template argument list
   27 |     template<class ForwardIterator1, class BinaryPredicate = equal_to<>>
      |                                                                       ^~
p761.cpp:27:71: error: wrong number of template arguments (0, should be 1)
In file included from /usr/local/include/c++/12.1.0/string:48,
                 from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
                 from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
                 from /usr/local/include/c++/12.1.0/ios:42,
                 from /usr/local/include/c++/12.1.0/ostream:38,
                 from /usr/local/include/c++/12.1.0/iostream:39,
                 from N4910.h:2:
/usr/local/include/c++/12.1.0/bits/stl_function.h:373:12: note: provided for 'template<class _Tp> struct std::equal_to'
  373 |     struct equal_to : public binary_function<_Tp, _Tp, bool>
      |            ^~~~~~~~
p761.cpp:28:28: error: definition of 'class std::default_searcher' inside template parameter list
   28 |     class default_searcher {
      |                            ^
p761.cpp:39:2: error: expected '>' before ';' token
   39 | }; }
      |  ^
p761.cpp:39:2: error: expected unqualified-id before ';' token
p761.cpp:41:6: error: 'constexpr' does not name a type
   41 |      constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
      |      ^~~~~~~~~
p761.cpp:41:6: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p761.cpp:46:3: error: 'constexpr' does not name a type
   46 |   constexpr pair<ForwardIterator2, ForwardIterator2>
      |   ^~~~~~~~~
p761.cpp:46:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p761.cpp:54:27: error: 'hash' does not name a type
   54 |              class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
      |                           ^~~~
p761.cpp:54:31: error: expected '>' before '<' token
   54 |              class Hash = hash<typename iterator_traits<RandomAccessIterator1>::value_type>,
      |                               ^
p761.cpp:56:32: error: expected unqualified-id before '{' token
   56 |     class boyer_moore_searcher {
      |                                ^
p761.cpp:72:1: error: 'only' does not name a type
   72 | only only only only
      | ^~~~
p761.cpp:84:69: error: non-member function 'std::pair<RandomAccessIterator2, RandomAccessIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' cannot have cv-qualifier
   84 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      |                                                                     ^~~~~
p761.cpp:84:1: error: 'std::pair<RandomAccessIterator2, RandomAccessIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' must be a non-static member function
   84 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      | ^~~~~~~~
p761.cpp:87:1: error: 'i' does not name a type
   87 | i// — i is the first iterator in the range [first,last - (pat_last_ - pat_first_)) such that for every non-negative integer n less than pat_last_ - pat_first_ the following condition holds: pred(*(i + n), *(pat_first_ + n)) != false, and
      | ^
p761.cpp:111:30: error: expected constructor, destructor, or type conversion before '(' token
  111 | boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
      |                              ^
p761.cpp:124:69: error: non-member function 'std::pair<RandomAccessIterator2, RandomAccessIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' cannot have cv-qualifier
  124 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      |                                                                     ^~~~~
p761.cpp:124:1: error: 'std::pair<RandomAccessIterator2, RandomAccessIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' must be a non-static member function
  124 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      | ^~~~~~~~

$ g++ p761.cpp -std=2b -o p761g -I. -Wall
p761.cpp:41:48: error: expected ')' before 'pat_first'
   41 |      constexpr default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
      |                                ~               ^~~~~~~~~~
      |                                                )
p761.cpp:47:59: error: non-member function 'constexpr std::pair<ForwardIterator2, ForwardIterator2> operator()(ForwardIterator2, ForwardIterator2)' cannot have cv-qualifier
   47 | operator()(ForwardIterator2 first, ForwardIterator2 last) const;
      |                                                           ^~~~~
p761.cpp:47:1: error: 'constexpr std::pair<ForwardIterator2, ForwardIterator2> operator()(ForwardIterator2, ForwardIterator2)' must be a non-static member function
   47 | operator()(ForwardIterator2 first, ForwardIterator2 last) const;
      | ^~~~~~~~
p761.cpp:72:1: error: 'only' does not name a type
   72 | only only only only
      | ^~~~
p761.cpp:84:69: error: non-member function 'std::pair<ForwardIterator2, ForwardIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' cannot have cv-qualifier
   84 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      |                                                                     ^~~~~
p761.cpp:84:1: error: 'std::pair<ForwardIterator2, ForwardIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' must be a non-static member function
   84 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      | ^~~~~~~~
p761.cpp:87:1: error: 'i' does not name a type
   87 | i// — i is the first iterator in the range [first,last - (pat_last_ - pat_first_)) such that for every non-negative integer n less than pat_last_ - pat_first_ the following condition holds: pred(*(i + n), *(pat_first_ + n)) != false, and
      | ^
p761.cpp:111:30: error: expected constructor, destructor, or type conversion before '(' token
  111 | boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first,
      |                              ^
p761.cpp:124:69: error: non-member function 'std::pair<ForwardIterator2, ForwardIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' cannot have cv-qualifier
  124 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      |                                                                     ^~~~~
p761.cpp:124:1: error: 'std::pair<ForwardIterator2, ForwardIterator2> operator()(RandomAccessIterator2, RandomAccessIterator2)' must be a non-static member function
  124 | operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
      | ^~~~~~~~

```

## 検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

<!-- リンクエラーの解説をする。clang++とg++の比較。意味のある出力。
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。-->

# 参考資料(reference)


関連する自己参照以外は、こちらの先頭に移転。

C言語（C++)に対する誤解、曲解、無理解、爽快。

https://qiita.com/kaizen_nagoya/items/3f3992c9722c1cee2e3a

#include "N4910.h"

https://qiita.com/kaizen_nagoya/items/163a47cef7d6bb1c33a8

C++N4910資料の改善点

https://qiita.com/kaizen_nagoya/items/fb4ceb5d117a54641af3

dockerにclang

https://qiita.com/kaizen_nagoya/items/8829ffeee397eda50e80

docker gnu(gcc/g++) and llvm(clang/clang++)

https://qiita.com/drafts/059874ea39c4de64c0f7

コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)

https://qiita.com/kaizen_nagoya/items/74220c0577a512c2d7da


C++N4910:2022 tag follower 300人超えました。ありがとうございます。

https://qiita.com/kaizen_nagoya/items/a63fb96d351ac5c16ff7

astyle 使ってみた

https://qiita.com/kaizen_nagoya/items/3c9a87a781d53a1a23f3

DoCAP（ドゥーキャップ）って何ですか？

https://qiita.com/kaizen_nagoya/items/47e0e6509ab792c43327

小川メソッド　覚え（書きかけ）

https://qiita.com/kaizen_nagoya/items/3593d72eca551742df68

 ＜この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。＞

# 文書履歴(document history)
ver. 0.01 初稿 　20220731