32.9 Class template match_results [re.results] C++N4910:2022 (704) p1643.cpp

# はじめに(Introduction)

N4910  Working Draft, Standard for Programming Language C++

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

C++ n4910は、ISO/IEC JTC1 SC22 WG21の作業原案(Working Draft)です。
公式のISO/IEC 14882原本ではありません。
ISO/IEC JTC1 SC22 のWG21を含むいくつかのWGでは、可能な限り作業文書を公開し、幅広い意見を求めています。

ISO/IEC JTC1 SC7からISO/IEC JTC1 SC22リエゾンとして、2000年頃、C/C++の品質向上に貢献しようとした活動をしていたことがあります。その頃は、まだISO/IEC TS 17961の原案が出る前です。Cの精神が優勢で、セキュリティ対策は補助的な位置付けでした。ISO/IEC TS 17961の制定と、C/C++のライブラリ類の見直しと、C++の進化はどんどん進んでいきます。　

進化の具合が、どちらに行こうとしているかは、コンパイルて実行させてみないとわかりません。C/C++の規格案の電子ファイルは、そのままコンパイルできる形式であるとよいと主張してきました。MISRA-C/C++, CERTC/C++でも同様です。MISRA-C/C++は、Example Suiteという形で、コード断片をコンパイルできる形で提供するようになりました。

一連の記事はコード断片をコンパイルできる形にする方法を検討してコンパイル、リンク、実行して、規格案の原文と処理系(g++, Clang++)との違いを確認し、技術内容を検討し、ISO/IEC JTC1 SC22 WG21にフィードバックするために用います。
また、CERT C++, MISRA C++等のコーディング標準のコード断片をコンパイルする際の参考にさせていただこうと考えています。CERT C++, MISRA C++が標準化の動きとの時間的なずれがあれば確認できれば幸いです。また、boostライブラリとの関連、Linux OS, 箱庭プロジェクト、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

```macOS:bash
// 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 = "32.9 Class template match_results [re.results] C++N4910:2022 (704) p1643.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;

// 32.9.1 General [re.results.general]
//  Class template match_results denotes a collection of character sequences representing the result of a regular expression match. Storage for the collection is allocated and freed as necessary by the member functions of class template match_results.
//  The class template match_results meets the requirements of an allocator-aware container and of a sequence container (24.2.2.1, 24.2.4) except that only copy assignment, move assignment, and operations defined for const-qualified sequence containers are supported and that the semantics of the comparison operator functions are different from those required for a container.
//  A default-constructed match_results object has no fully established result state. A match result is ready when, as a consequence of a completed regular expression match modifying such an object, its result state becomes fully established. The effects of calling most member functions from a match_results object that is not ready are undefined.
//  The sub_match object stored at index 0 represents sub-expression 0, i.e., the whole match. In this case the sub_match member matched is always true. The sub_match object stored at index n denotes what matched the marked sub-expression n within the matched expression. If the sub-expression n participated in a regular expression match then the sub_match member matched evaluates to true, and members first and second denote the range of characters [first, second) which formed that match. Otherwise matched is false, and members first and second point to the end of the sequence that was searched.
// [Note 1: The sub_match objects representing different sub-expressions that did not participate in a regular expression match need not be distinct.
namespace std {
template<class BidirectionalIterator,
         class Allocator = allocator<sub_match<BidirectionalIterator>>>
class match_results {
public:
    using value_type      = sub_match<BidirectionalIterator>;
    using const_reference = const value_type&;
    using reference = value_type&;
    using const_iterator = const_iterator;
    using iterator = implementation-defined ;
    using difference_type =  typename iterator_traits<BidirectionalIterator>::difference_type;
    using size_type       = typename allocator_traits<Allocator>::size_type;
    using allocator_type  = Allocator;
    using char_type       =       typename iterator_traits<BidirectionalIterator>::value_type;
    using string_type     = basic_string<char_type>;
// 32.9.2, construct/copy/destroy
    match_results() : match_results(Allocator()) {} explicit match_results(const Allocator&);
    match_results(const match_results& m);
    match_results(match_results&& m) noexcept;
    match_results& operator=(const match_results& m);
    match_results& operator=(match_results&& m);
    ~match_results();
// 32.9.3, state
    bool ready() const;
// 32.9.4, size
    size_type size() const;
    size_type max_size() const;
    [[nodiscard]] bool empty() const;
// 32.9.5, element access
    difference_type length(size_type sub = 0) const;
    difference_type position(size_type sub = 0) const;
    string_type str(size_type sub = 0) const;
    const_reference operator[](size_type n) const;
    const_reference prefix() const;
    const_reference suffix() const;
    const_iterator begin() const;
    const_iterator end() const;
    const_iterator cbegin() const;
    const_iterator cend() const;
// 32.9.6, format template<class OutputIter>
    OutputIter
    format(OutputIter out,
           const char_type* fmt_first, const char_type* fmt_last,
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
    template<class OutputIter, class ST, class SA>
    OutputIter
    format(OutputIter out,
           const basic_string<char_type, ST, SA>& fmt,
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
    template<class ST, class SA>
    basic_string<char_type, ST, SA>
    format(const basic_string<char_type, ST, SA>& fmt,
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
// Postconditions: As specified in Table 137.
}
string_type
format(const char_type* fmt,
       regex_constants::match_flag_type flags = regex_constants::format_default) const;
// 32.9.7, allocator
allocator_type get_allocator() const;
// 32.9.8, swap
void swap(match_results& that);
};
// 32.9.2 Constructors [re.results.const]
//  Table 137 lists the postconditions of match_results copy/move constructors and copy/move assignment operators. For move operations, the results of the expressions depending on the parameter m denote the values they had before the respective function calls.
explicit match_results(const Allocator& a);
// Postconditions: ready() returns false. size() returns 0.
match_results(const match_results& m);
match_results(match_results&& m) noexcept;
// Effects: The stored Allocator value is move constructed from m.get_allocator(). Postconditions: As specified in Table 137.
match_results& operator=(const match_results& m);
// Postconditions: As specified in Table 137.
match_results& operator=(match_results&& m);
// Postconditions: As specified in Table 137.
// Table 137: match_results copy/move operation postconditions [tab:re.results.const]
//    Element Value
//     ready() m.ready()
//   size() m.size()
//   str(n) m.str(n) for all non-negative integers n < m.size()
//   prefix() m.prefix()
//   suffix() m.suffix()
//   (*this)[n] m[n] for all non-negative integers n < m.size()
//    length(n) m.length(n) for all non-negative integers n < m.size()
//    position(n) m.position(n) for all non-negative integers n < m.size()
// Returns: true if *this has a fully established result state, otherwise false.
// 32.9.3 State [re.results.state]
bool ready() const;
// Returns: One plus the number of marked sub-expressions in the regular expression that was matched if *this represents the result of a successful match. Otherwise returns 0.
// 32.9.4 Size [re.results.size]
size_type size() const;
// [Note 1: The state of a match_results object can be modified only by passing that object to regex_match or regex_search. Subclauses 32.10.2 and 32.10.3 specify the effects of those algorithms on their match_results arguments.
size_type max_size() const;
// Returns: The maximum number of sub_match elements that can be stored in *this.
[[nodiscard]] bool empty() const;
// Returns: size() == 0.
// 32.9.5 Element access [re.results.acc]
difference_type length(size_type sub = 0) const;
// Preconditions: ready() == true. Returns: (*this)[sub].length().
difference_type position(size_type sub = 0) const;
// Preconditions: ready() == true.
// Returns: The distance from the start of the target sequence to (*this)[sub].first.
string_type str(size_type sub = 0) const;
// Preconditions: ready() == true. Returns: string_type((*this)[sub]).
const_reference operator[](size_type n) const;
// Preconditions: ready() == true.
// Returns: A reference to the sub_match object representing the character sequence that matched marked sub-expression n. If n == 0 then returns a reference to a sub_match object representing the character sequence that matched the whole regular expression. If n >= size() then returns a sub_match object representing an unmatched sub-expression.
const_reference prefix() const;
// Preconditions: ready() == true.
// Returns: A reference to the sub_match object representing the character sequence from the start of the
string being matched/searched to the start of the match found.
const_reference suffix() const;
// Preconditions: ready() == true.
// Returns: A reference to the sub_match object representing the character sequence from the end of the match found to the end of the string being matched/searched.
const_iterator begin() const;
const_iterator cbegin() const;
Returns:
A starting iterator that enumerates over all the sub-expressions stored in *this. const_iterator end() const;
const_iterator cend() const;
// Returns: A terminating iterator that enumerates over all the sub expressions stored in *this.
// 32.9.6 Formatting [re.results.form]
template<class OutputIter>
OutputIter format(
    OutputIter out,
    const char_type* fmt_first, const char_type* fmt_last,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
// Preconditions: ready() == true and OutputIter meets the requirements for a Cpp17OutputIterator (25.3.5.4).
// Returns: true if neither match result is ready, false if one match result is ready and the other is not. If both match results are ready, returns true only if:
// Effects: Copies the character sequence [fmt_first, fmt_last) to OutputIter out.
// Replaces each format specifier or escape sequence in the copied range with either the character(s) it represents or the sequence of characters within *this to which it refers.
// The bitmasks specified in flags determine which format specifiers and escape sequences are recognized.
// Returns: out.
// Effects: As if by m1.swap(m2).
// 32.9.9 Non-member functions [re.results.nonmember]
template<class OutputIter, class ST, class SA>
OutputIter format(
    OutputIter out,
    const basic_string<char_type, ST, SA>& fmt,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
// Effects: Equivalent to:
return format(out, fmt.data(), fmt.data() + fmt.size(), flags);
template<class ST, class SA>
basic_string<char_type, ST, SA> format(
    const basic_string<char_type, ST, SA>& fmt,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
// Preconditions: ready() == true.
// Effects: Constructs an empty string result of type basic_string<char_type, ST, SA> and calls:
format(back_inserter(result), fmt, flags);
// Returns: result.
string_type format(
    const char_type* fmt,
    regex_constants::match_flag_type flags = regex_constants::format_default) const;
// Preconditions: ready() == true.
// Effects: Constructs an empty string result of type string_type and calls:
format(back_inserter(result), fmt, fmt + char_traits<char_type>::length(fmt), flags);
// Returns: result.
// 32.9.7 Allocator [re.results.all]
allocator_type get_allocator() const;
// Returns: A copy of the Allocator that was passed to the object’s constructor or, if that allocator has been replaced, a copy of the most recent replacement.
// 32.9.8 Swap [re.results.swap]
void swap(match_results& that);
// Effects: Swaps the contents of the two sequences.
// Postconditions: *this contains the sequence of matched sub-expressions that were in that, that contains the sequence of matched sub-expressions that were in *this.  Complexity: Constant time.
template<class BidirectionalIterator, class Allocator>
void swap(match_results<BidirectionalIterator, Allocator>& m1,
          match_results<BidirectionalIterator, Allocator>& m2);
template<class BidirectionalIterator, class Allocator>
bool operator==(const match_results<BidirectionalIterator, Allocator>& m1,
                const match_results<BidirectionalIterator, Allocator>& m2);
// — m1.empty() && m2.empty(), or
// — !m1.empty() && !m2.empty(), and the following conditions are satisfied:
// — m1.prefix() == m2.prefix(),
// — m1.size() == m2.size() && equal(m1.begin(), m1.end(), m2.begin()), and — m1.suffix() == m2.suffix().
// [Note 1: The algorithm equal is defined in Clause 27.
int main() {
    cout  <<  n4910 << endl;
    return EXIT_SUCCESS;
}
```

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

```ubuntu:bash
$ clang++ p1643.cpp -std=03 -o p1643l -I. -Wall
In file included from p1643.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 \
 ^
p1643.cpp:22:71: error: a space is required between consecutive right angle brackets (use '> >')
           class Allocator = allocator<sub_match<BidirectionalIterator>>>
                                                                      ^~
                                                                      > > 
p1643.cpp:22:40: error: use of undeclared identifier 'sub_match'
           class Allocator = allocator<sub_match<BidirectionalIterator>>>
                                       ^
p1643.cpp:25:31: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
      using value_type      = sub_match<BidirectionalIterator>;
                              ^
p1643.cpp:25:31: error: no template named 'sub_match'
p1643.cpp:26:31: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
      using const_reference = const value_type&;
                              ^
p1643.cpp:26:37: error: unknown type name 'value_type'; did you mean '_Bit_const_iterator::value_type'?
      using const_reference = const value_type&;
                                    ^~~~~~~~~~
                                    _Bit_const_iterator::value_type
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator_base_types.h:132:26: note: '_Bit_const_iterator::value_type' declared here
      typedef _Tp        value_type;
                         ^
p1643.cpp:27:19: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using reference = value_type&;
                  ^
p1643.cpp:27:19: error: unknown type name 'value_type'; did you mean '_Bit_const_iterator::value_type'?
using reference = value_type&;
                  ^~~~~~~~~~
                  _Bit_const_iterator::value_type
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator_base_types.h:132:26: note: '_Bit_const_iterator::value_type' declared here
      typedef _Tp        value_type;
                         ^
p1643.cpp:28:24: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using const_iterator = const_iterator;
                       ^
p1643.cpp:28:24: error: unknown type name 'const_iterator'; did you mean '_Bit_const_iterator::const_iterator'?
using const_iterator = const_iterator;
                       ^~~~~~~~~~~~~~
                       _Bit_const_iterator::const_iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_bvector.h:332:34: note: '_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
p1643.cpp:29:18: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using iterator = implementation-defined ; 
                 ^
p1643.cpp:29:18: error: unknown type name 'implementation'
p1643.cpp:29:32: error: expected ';' after alias declaration
using iterator = implementation-defined ; 
                               ^
                               ;
p1643.cpp:30:26: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using difference_type =  typename iterator_traits<BidirectionalIterator>::difference_type;
                         ^
p1643.cpp:31:25: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using size_type       = typename allocator_traits<Allocator>::size_type;
                        ^
p1643.cpp:31:34: error: no template named 'allocator_traits'; did you mean 'iterator_traits'?
using size_type       = typename allocator_traits<Allocator>::size_type;
                                 ^~~~~~~~~~~~~~~~
                                 iterator_traits
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator_base_types.h:182:12: note: 'iterator_traits' declared here
    struct iterator_traits
           ^
p1643.cpp:32:25: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using allocator_type  = Allocator;
                        ^
p1643.cpp:33:31: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using char_type       =       typename iterator_traits<BidirectionalIterator>::value_type;
                              ^
p1643.cpp:34:25: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using string_type     = basic_string<char_type>;
                        ^
p1643.cpp:37:67: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
match_results(const match_results& m); match_results(match_results&& m) noexcept; 
                                                                  ^
p1643.cpp:37:72: error: expected ';' at end of declaration list
match_results(const match_results& m); match_results(match_results&& m) noexcept; 
                                                                       ^
                                                                       ;
p1643.cpp:38:89: warning: rvalue references are a C++11 extension [-Wc++11-extensions]
match_results& operator=(const match_results& m); match_results& operator=(match_results&& m); ~match_results();
                                                                                        ^
p1643.cpp:43:30: error: expected expression
size_type max_size() const; [[nodiscard]] bool empty() const;
                             ^
p1643.cpp:43:43: error: expected member name or ';' after declaration specifiers
size_type max_size() const; [[nodiscard]] bool empty() const;
                                          ^
p1643.cpp:53:3: error: unknown type name 'OutputIter'
  OutputIter
  ^
p1643.cpp:54:12: error: unknown type name 'OutputIter'
    format(OutputIter out,
           ^
p1643.cpp:56:12: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
           ^
p1643.cpp:61:12: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
           ^
p1643.cpp:65:12: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
           ^
p1643.cpp:56:53: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
                                                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
12 warnings and 20 errors generated.
$ clang++ p1643.cpp -std=2b -o p1643l -I. -Wall
p1643.cpp:22:40: error: use of undeclared identifier 'sub_match'
           class Allocator = allocator<sub_match<BidirectionalIterator>>>
                                       ^
p1643.cpp:25:31: error: no template named 'sub_match'
      using value_type      = sub_match<BidirectionalIterator>;
                              ^
p1643.cpp:26:37: error: unknown type name 'value_type'; did you mean '_Bit_const_iterator::value_type'?
      using const_reference = const value_type&;
                                    ^~~~~~~~~~
                                    _Bit_const_iterator::value_type
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator_base_types.h:132:26: note: '_Bit_const_iterator::value_type' declared here
      typedef _Tp        value_type;
                         ^
p1643.cpp:27:19: error: unknown type name 'value_type'; did you mean '_Bit_const_iterator::value_type'?
using reference = value_type&;
                  ^~~~~~~~~~
                  _Bit_const_iterator::value_type
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator_base_types.h:132:26: note: '_Bit_const_iterator::value_type' declared here
      typedef _Tp        value_type;
                         ^
p1643.cpp:28:24: error: unknown type name 'const_iterator'; did you mean '_Bit_const_iterator::const_iterator'?
using const_iterator = const_iterator;
                       ^~~~~~~~~~~~~~
                       _Bit_const_iterator::const_iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_bvector.h:332:34: note: '_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
p1643.cpp:29:18: error: unknown type name 'implementation'
using iterator = implementation-defined ; 
                 ^
p1643.cpp:29:32: error: expected ';' after alias declaration
using iterator = implementation-defined ; 
                               ^
                               ;
p1643.cpp:53:3: error: unknown type name 'OutputIter'
  OutputIter
  ^
p1643.cpp:54:12: error: unknown type name 'OutputIter'
    format(OutputIter out,
           ^
p1643.cpp:56:12: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
           ^
p1643.cpp:61:12: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
           ^
p1643.cpp:65:12: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
           ^
p1643.cpp:56:53: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
                                                    ^
p1643.cpp:61:53: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
                                                    ^
p1643.cpp:65:53: error: use of undeclared identifier 'regex_constants'
           regex_constants::match_flag_type flags = regex_constants::format_default) const;
                                                    ^
p1643.cpp:67:2: error: expected ';' after class
}
 ^
 ;
p1643.cpp:68:1: error: unknown type name 'string_type'
string_type
^
p1643.cpp:69:16: error: unknown type name 'char_type'
  format(const char_type* fmt,
               ^
p1643.cpp:70:10: error: use of undeclared identifier 'regex_constants'
         regex_constants::match_flag_type flags = regex_constants::format_default) const;
         ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p1643.cpp -std=03 -o p1643g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p1643.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 \
      |  ^~~~~
p1643.cpp:37:73: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   37 | match_results(const match_results& m); match_results(match_results&& m) noexcept;
      |                                                                         ^~~~~~~~
p1643.cpp:22:40: error: 'sub_match' was not declared in this scope
   22 |            class Allocator = allocator<sub_match<BidirectionalIterator>>>
      |                                        ^~~~~~~~~
p1643.cpp:22:73: error: template argument 1 is invalid
   22 |            class Allocator = allocator<sub_match<BidirectionalIterator>>>
      |                                                                         ^
p1643.cpp:23:25: error: definition of 'class std::match_results' inside template parameter list
   23 |     class match_results {
      |                         ^
p1643.cpp:68:1: error: expected '>' before 'string_type'
   68 | string_type
      | ^~~~~~~~~~~
p1643.cpp:70:89: error: expected unqualified-id before ';' token
   70 |          regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                                         ^
p1643.cpp:72:1: error: 'allocator_type' does not name a type; did you mean 'allocator'?
   72 | allocator_type get_allocator() const;
      | ^~~~~~~~~~~~~~
      | allocator
p1643.cpp:74:8: error: variable or field 'swap' declared void
   74 |   void swap(match_results& that);
      |        ^~~~
p1643.cpp:74:13: error: 'match_results' was not declared in this scope
   74 |   void swap(match_results& that);
      |             ^~~~~~~~~~~~~
p1643.cpp:74:28: error: 'that' was not declared in this scope
   74 |   void swap(match_results& that);
      |                            ^~~~
p1643.cpp:78:33: error: 'Allocator' does not name a type; did you mean 'alloca'?
   78 |    explicit match_results(const Allocator& a);
      |                                 ^~~~~~~~~
      |                                 alloca
p1643.cpp:78:13: error: ISO C++ forbids declaration of 'match_results' with no type [-fpermissive]
   78 |    explicit match_results(const Allocator& a);
      |             ^~~~~~~~~~~~~
p1643.cpp:78:4: error: 'explicit' outside class declaration
   78 |    explicit match_results(const Allocator& a);
      |    ^~~~~~~~
p1643.cpp:80:21: error: 'match_results' does not name a type
   80 | match_results(const match_results& m);
      |                     ^~~~~~~~~~~~~
p1643.cpp:80:38: error: expected constructor, destructor, or type conversion before ';' token
   80 | match_results(const match_results& m);
      |                                      ^
p1643.cpp:81:14: error: expected constructor, destructor, or type conversion before '(' token
   81 | match_results(match_results&& m) noexcept;
      |              ^
p1643.cpp:83:1: error: 'match_results' does not name a type
   83 | match_results& operator=(const match_results& m);
      | ^~~~~~~~~~~~~
p1643.cpp:85:1: error: 'match_results' does not name a type
   85 | match_results& operator=(match_results&& m);
      | ^~~~~~~~~~~~~
p1643.cpp:99:14: error: non-member function 'bool ready()' cannot have cv-qualifier
   99 | bool ready() const;
      |              ^~~~~
p1643.cpp:102:1: error: 'size_type' does not name a type; did you mean 'size_t'?
  102 | size_type size() const;
      | ^~~~~~~~~
      | size_t
p1643.cpp:104:1: error: 'size_type' does not name a type; did you mean 'size_t'?
  104 | size_type max_size() const;
      | ^~~~~~~~~
      | size_t
p1643.cpp:106:1: error: expected unqualified-id before '[' token
  106 | [[nodiscard]] bool empty() const;
      | ^
p1643.cpp:109:1: error: 'difference_type' does not name a type
  109 | difference_type length(size_type sub = 0) const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:111:1: error: 'difference_type' does not name a type
  111 | difference_type position(size_type sub = 0) const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:114:1: error: 'string_type' does not name a type
  114 | string_type str(size_type sub = 0) const;
      | ^~~~~~~~~~~
p1643.cpp:116:1: error: 'const_reference' does not name a type
  116 | const_reference operator[](size_type n) const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:119:1: error: 'const_reference' does not name a type
  119 | const_reference prefix() const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:122:14: error: expected initializer before 'matched'
  122 | string being matched/searched to the start of the match found.
      |              ^~~~~~~
p1643.cpp:126:1: error: 'const_iterator' does not name a type
  126 | const_iterator begin() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:127:1: error: 'const_iterator' does not name a type
  127 | const_iterator cbegin() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:128:8: error: found ':' in nested-name-specifier, expected '::'
  128 | Returns: A starting iterator that enumerates over all the sub-expressions stored in *this. const_iterator end() const;
      |        ^
      |        ::
p1643.cpp:128:1: error: 'Returns' does not name a type
  128 | Returns: A starting iterator that enumerates over all the sub-expressions stored in *this. const_iterator end() const;
      | ^~~~~~~
p1643.cpp:129:1: error: 'const_iterator' does not name a type
  129 | const_iterator cend() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:135:8: error: 'char_type' does not name a type
  135 |  const char_type* fmt_first, const char_type* fmt_last,
      |        ^~~~~~~~~
p1643.cpp:135:36: error: 'char_type' does not name a type
  135 |  const char_type* fmt_first, const char_type* fmt_last,
      |                                    ^~~~~~~~~
p1643.cpp:136:2: error: 'regex_constants' has not been declared
  136 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |  ^~~~~~~~~~~~~~~
p1643.cpp:136:35: error: expected ',' or '...' before 'flags'
  136 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                   ^~~~~
p1643.cpp:136:76: error: non-member function 'OutputIter format(OutputIter, const int*, const int*, int)' cannot have cv-qualifier
  136 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                            ^~~~~
p1643.cpp:148:21: error: 'char_type' was not declared in this scope
  148 |  const basic_string<char_type, ST, SA>& fmt,
      |                     ^~~~~~~~~
p1643.cpp:148:38: error: template argument 1 is invalid
  148 |  const basic_string<char_type, ST, SA>& fmt,
      |                                      ^
p1643.cpp:149:2: error: 'regex_constants' has not been declared
  149 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |  ^~~~~~~~~~~~~~~
p1643.cpp:149:35: error: expected ',' or '...' before 'flags'
  149 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                   ^~~~~
p1643.cpp:149:76: error: non-member function 'OutputIter format(OutputIter, const int&, int)' cannot have cv-qualifier
  149 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                            ^~~~~
p1643.cpp:151:1: error: expected unqualified-id before 'return'
  151 | return format(out, fmt.data(), fmt.data() + fmt.size(), flags);
      | ^~~~~~
p1643.cpp:153:16: error: 'char_type' was not declared in this scope
  153 |   basic_string<char_type, ST, SA> format(
      |                ^~~~~~~~~
p1643.cpp:153:33: error: template argument 1 is invalid
  153 |   basic_string<char_type, ST, SA> format(
      |                                 ^
p1643.cpp:154:21: error: 'char_type' was not declared in this scope
  154 |  const basic_string<char_type, ST, SA>& fmt,
      |                     ^~~~~~~~~
p1643.cpp:154:38: error: template argument 1 is invalid
  154 |  const basic_string<char_type, ST, SA>& fmt,
      |                                      ^
p1643.cpp:155:2: error: 'regex_constants' has not been declared
  155 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |  ^~~~~~~~~~~~~~~
p1643.cpp:155:35: error: expected ',' or '...' before 'flags'
  155 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                   ^~~~~
p1643.cpp:155:76: error: non-member function 'int format(const int&, int)' cannot have cv-qualifier
  155 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                            ^~~~~
p1643.cpp:158:9: error: expected constructor, destructor, or type conversion before '(' token
  158 |   format(back_inserter(result), fmt, flags);
      |         ^
p1643.cpp:160:1: error: 'string_type' does not name a type
  160 | string_type format(
      | ^~~~~~~~~~~
p1643.cpp:165:9: error: expected constructor, destructor, or type conversion before '(' token
  165 |   format(back_inserter(result), fmt, fmt + char_traits<char_type>::length(fmt), flags);
      |         ^
p1643.cpp:168:1: error: 'allocator_type' does not name a type
  168 | allocator_type get_allocator() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:171:6: error: variable or field 'swap' declared void
  171 | void swap(match_results& that);
      |      ^~~~
p1643.cpp:171:26: error: 'that' was not declared in this scope
  171 | void swap(match_results& that);
      |                          ^~~~
p1643.cpp:175:8: error: variable or field 'swap' declared void
  175 |   void swap(match_results<BidirectionalIterator, Allocator>& m1,
      |        ^~~~
p1643.cpp:175:48: error: expected primary-expression before ',' token
  175 |   void swap(match_results<BidirectionalIterator, Allocator>& m1,
      |                                                ^
p1643.cpp:175:59: error: expected primary-expression before '>' token
  175 |   void swap(match_results<BidirectionalIterator, Allocator>& m1,
      |                                                           ^
p1643.cpp:175:62: error: 'm1' was not declared in this scope; did you mean 'y1'?
  175 |   void swap(match_results<BidirectionalIterator, Allocator>& m1,
      |                                                              ^~
      |                                                              y1
p1643.cpp:176:48: error: expected primary-expression before ',' token
  176 |             match_results<BidirectionalIterator, Allocator>& m2);
      |                                                ^
p1643.cpp:176:59: error: expected primary-expression before '>' token
  176 |             match_results<BidirectionalIterator, Allocator>& m2);
      |                                                           ^
p1643.cpp:176:62: error: 'm2' was not declared in this scope
  176 |             match_results<BidirectionalIterator, Allocator>& m2);
      |                                                              ^~
p1643.cpp:178:23: error: 'match_results' does not name a type
  178 | bool operator==(const match_results<BidirectionalIterator, Allocator>& m1,
      |                       ^~~~~~~~~~~~~
p1643.cpp:178:36: error: expected ',' or '...' before '<' token
  178 | bool operator==(const match_results<BidirectionalIterator, Allocator>& m1,
      |                                    ^
p1643.cpp:178:6: error: 'bool operator==(int)' must have an argument of class or enumerated type
  178 | bool operator==(const match_results<BidirectionalIterator, Allocator>& m1,
      |      ^~~~~~~~

$ g++ p1643.cpp -std=2b -o p1643g -I. -Wall
p1643.cpp:22:40: error: 'sub_match' was not declared in this scope
   22 |            class Allocator = allocator<sub_match<BidirectionalIterator>>>
      |                                        ^~~~~~~~~
p1643.cpp:22:71: error: template argument 1 is invalid
   22 |            class Allocator = allocator<sub_match<BidirectionalIterator>>>
      |                                                                       ^~
p1643.cpp:25:31: error: 'sub_match' does not name a type
   25 |       using value_type      = sub_match<BidirectionalIterator>;
      |                               ^~~~~~~~~
p1643.cpp:26:37: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
   26 |       using const_reference = const value_type&;
      |                                     ^~~~~~~~~~
p1643.cpp:26:36: error: expected ';' before 'value_type'
   26 |       using const_reference = const value_type&;
      |                                    ^~~~~~~~~~~
      |                                    ;
p1643.cpp:27:19: error: 'value_type' does not name a type; did you mean 'false_type'?
   27 | using reference = value_type&;
      |                   ^~~~~~~~~~
      |                   false_type
p1643.cpp:28:24: error: 'const_iterator' does not name a type; did you mean 'move_iterator'?
   28 | using const_iterator = const_iterator;
      |                        ^~~~~~~~~~~~~~
      |                        move_iterator
p1643.cpp:29:18: error: 'implementation' does not name a type
   29 | using iterator = implementation-defined ;
      |                  ^~~~~~~~~~~~~~
p1643.cpp:45:143: error: 'const_reference' does not name a type; did you mean 'is_reference'?
   45 | difference_type length(size_type sub = 0) const; difference_type position(size_type sub = 0) const; string_type str(size_type sub = 0) const; const_reference operator[](size_type n) const;
      |                                                                                                                                               ^~~~~~~~~~~~~~~
      |                                                                                                                                               is_reference
p1643.cpp:46:1: error: 'const_reference' does not name a type; did you mean 'is_reference'?
   46 | const_reference prefix() const;
      | ^~~~~~~~~~~~~~~
      | is_reference
p1643.cpp:47:1: error: 'const_reference' does not name a type; did you mean 'is_reference'?
   47 | const_reference suffix() const;
      | ^~~~~~~~~~~~~~~
      | is_reference
p1643.cpp:48:1: error: 'const_iterator' does not name a type; did you mean 'move_iterator'?
   48 | const_iterator begin() const;
      | ^~~~~~~~~~~~~~
      | move_iterator
p1643.cpp:49:1: error: 'const_iterator' does not name a type; did you mean 'move_iterator'?
   49 | const_iterator end() const;
      | ^~~~~~~~~~~~~~
      | move_iterator
p1643.cpp:50:1: error: 'const_iterator' does not name a type; did you mean 'move_iterator'?
   50 | const_iterator cbegin() const;
      | ^~~~~~~~~~~~~~
      | move_iterator
p1643.cpp:51:1: error: 'const_iterator' does not name a type; did you mean 'move_iterator'?
   51 | const_iterator cend() const;
      | ^~~~~~~~~~~~~~
      | move_iterator
p1643.cpp:53:3: error: 'OutputIter' does not name a type
   53 |   OutputIter
      |   ^~~~~~~~~~
p1643.cpp:61:12: error: 'regex_constants' has not been declared
   61 |            regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |            ^~~~~~~~~~~~~~~
p1643.cpp:61:45: error: expected ',' or '...' before 'flags'
   61 |            regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                             ^~~~~
p1643.cpp:65:12: error: 'regex_constants' has not been declared
   65 |            regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |            ^~~~~~~~~~~~~~~
p1643.cpp:65:45: error: expected ',' or '...' before 'flags'
   65 |            regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                             ^~~~~
p1643.cpp:67:2: error: expected ';' before 'string_type'
   67 | }
      |  ^
      |  ;
   68 | string_type
      | ~~~~~~~~~~~
p1643.cpp:72:1: error: 'allocator_type' does not name a type; did you mean 'allocator_traits'?
   72 | allocator_type get_allocator() const;
      | ^~~~~~~~~~~~~~
      | allocator_traits
p1643.cpp:74:13: error: template placeholder type 'match_results<...auto...>' must be followed by a simple declarator-id
   74 |   void swap(match_results& that);
      |             ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:78:33: error: 'Allocator' does not name a type; did you mean 'alloca'?
   78 |    explicit match_results(const Allocator& a);
      |                                 ^~~~~~~~~
      |                                 alloca
p1643.cpp:78:13: error: deduction guide for 'std::match_results<BidirectionalIterator, Allocator>' must have trailing return type
   78 |    explicit match_results(const Allocator& a);
      |             ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:80:15: error: template placeholder type 'const match_results<...auto...>' must be followed by a simple declarator-id
   80 | match_results(const match_results& m);
      |               ^~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:80:1: error: deduction guide for 'std::match_results<BidirectionalIterator, Allocator>' must have trailing return type
   80 | match_results(const match_results& m);
      | ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:81:15: error: template placeholder type 'match_results<...auto...>' must be followed by a simple declarator-id
   81 | match_results(match_results&& m) noexcept;
      |               ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:81:1: error: deduction guide for 'std::match_results<BidirectionalIterator, Allocator>' must have trailing return type
   81 | match_results(match_results&& m) noexcept;
      | ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:83:26: error: template placeholder type 'const match_results<...auto...>' must be followed by a simple declarator-id
   83 | match_results& operator=(const match_results& m);
      |                          ^~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:83:1: error: deduced class type 'match_results' in function return type
   83 | match_results& operator=(const match_results& m);
      | ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:85:26: error: template placeholder type 'match_results<...auto...>' must be followed by a simple declarator-id
   85 | match_results& operator=(match_results&& m);
      |                          ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:85:1: error: deduced class type 'match_results' in function return type
   85 | match_results& operator=(match_results&& m);
      | ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
p1643.cpp:99:14: error: non-member function 'bool ready()' cannot have cv-qualifier
   99 | bool ready() const;
      |              ^~~~~
p1643.cpp:102:1: error: 'size_type' does not name a type; did you mean 'size_t'?
  102 | size_type size() const;
      | ^~~~~~~~~
      | size_t
p1643.cpp:104:1: error: 'size_type' does not name a type; did you mean 'size_t'?
  104 | size_type max_size() const;
      | ^~~~~~~~~
      | size_t
p1643.cpp:106:28: error: non-member function 'bool empty()' cannot have cv-qualifier
  106 | [[nodiscard]] bool empty() const;
      |                            ^~~~~
p1643.cpp:109:1: error: 'difference_type' does not name a type
  109 | difference_type length(size_type sub = 0) const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:111:1: error: 'difference_type' does not name a type
  111 | difference_type position(size_type sub = 0) const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:114:1: error: 'string_type' does not name a type
  114 | string_type str(size_type sub = 0) const;
      | ^~~~~~~~~~~
p1643.cpp:116:1: error: 'const_reference' does not name a type
  116 | const_reference operator[](size_type n) const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:119:1: error: 'const_reference' does not name a type
  119 | const_reference prefix() const;
      | ^~~~~~~~~~~~~~~
p1643.cpp:122:14: error: expected initializer before 'matched'
  122 | string being matched/searched to the start of the match found.
      |              ^~~~~~~
p1643.cpp:126:1: error: 'const_iterator' does not name a type
  126 | const_iterator begin() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:127:1: error: 'const_iterator' does not name a type
  127 | const_iterator cbegin() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:128:8: error: found ':' in nested-name-specifier, expected '::'
  128 | Returns: A starting iterator that enumerates over all the sub-expressions stored in *this. const_iterator end() const;
      |        ^
      |        ::
p1643.cpp:128:1: error: 'Returns' does not name a type
  128 | Returns: A starting iterator that enumerates over all the sub-expressions stored in *this. const_iterator end() const;
      | ^~~~~~~
p1643.cpp:129:1: error: 'const_iterator' does not name a type
  129 | const_iterator cend() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:135:8: error: 'char_type' does not name a type
  135 |  const char_type* fmt_first, const char_type* fmt_last,
      |        ^~~~~~~~~
p1643.cpp:135:36: error: 'char_type' does not name a type
  135 |  const char_type* fmt_first, const char_type* fmt_last,
      |                                    ^~~~~~~~~
p1643.cpp:136:2: error: 'regex_constants' has not been declared
  136 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |  ^~~~~~~~~~~~~~~
p1643.cpp:136:35: error: expected ',' or '...' before 'flags'
  136 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                   ^~~~~
p1643.cpp:136:76: error: non-member function 'OutputIter format(OutputIter, const int*, const int*, int)' cannot have cv-qualifier
  136 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                            ^~~~~
p1643.cpp:148:21: error: 'char_type' was not declared in this scope
  148 |  const basic_string<char_type, ST, SA>& fmt,
      |                     ^~~~~~~~~
p1643.cpp:148:38: error: template argument 1 is invalid
  148 |  const basic_string<char_type, ST, SA>& fmt,
      |                                      ^
p1643.cpp:149:2: error: 'regex_constants' has not been declared
  149 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |  ^~~~~~~~~~~~~~~
p1643.cpp:149:35: error: expected ',' or '...' before 'flags'
  149 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                   ^~~~~
p1643.cpp:149:76: error: non-member function 'OutputIter format(OutputIter, const int&, int)' cannot have cv-qualifier
  149 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                            ^~~~~
p1643.cpp:151:1: error: expected unqualified-id before 'return'
  151 | return format(out, fmt.data(), fmt.data() + fmt.size(), flags);
      | ^~~~~~
p1643.cpp:153:16: error: 'char_type' was not declared in this scope
  153 |   basic_string<char_type, ST, SA> format(
      |                ^~~~~~~~~
p1643.cpp:153:33: error: template argument 1 is invalid
  153 |   basic_string<char_type, ST, SA> format(
      |                                 ^
p1643.cpp:154:21: error: 'char_type' was not declared in this scope
  154 |  const basic_string<char_type, ST, SA>& fmt,
      |                     ^~~~~~~~~
p1643.cpp:154:38: error: template argument 1 is invalid
  154 |  const basic_string<char_type, ST, SA>& fmt,
      |                                      ^
p1643.cpp:155:2: error: 'regex_constants' has not been declared
  155 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |  ^~~~~~~~~~~~~~~
p1643.cpp:155:35: error: expected ',' or '...' before 'flags'
  155 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                   ^~~~~
p1643.cpp:155:76: error: non-member function 'int format(const int&, int)' cannot have cv-qualifier
  155 |  regex_constants::match_flag_type flags = regex_constants::format_default) const;
      |                                                                            ^~~~~
p1643.cpp:158:9: error: expected constructor, destructor, or type conversion before '(' token
  158 |   format(back_inserter(result), fmt, flags);
      |         ^
p1643.cpp:160:1: error: 'string_type' does not name a type
  160 | string_type format(
      | ^~~~~~~~~~~
p1643.cpp:165:9: error: expected constructor, destructor, or type conversion before '(' token
  165 |   format(back_inserter(result), fmt, fmt + char_traits<char_type>::length(fmt), flags);
      |         ^
p1643.cpp:168:1: error: 'allocator_type' does not name a type
  168 | allocator_type get_allocator() const;
      | ^~~~~~~~~~~~~~
p1643.cpp:171:11: error: template placeholder type 'match_results<...auto...>' must be followed by a simple declarator-id
  171 | void swap(match_results& that);
      |           ^~~~~~~~~~~~~
p1643.cpp:23:11: note: 'template<class BidirectionalIterator, class Allocator> class std::match_results' declared here
   23 |     class match_results {
      |           ^~~~~~~~~~~~~
```

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

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

## 応用例1　AUTOSAR C++

AUTOSARでC++のコーディング標準を作っている。　
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。　

Autosar Guidelines C++14 example code compile list

https://qiita.com/kaizen_nagoya/items/8ccbf6675c3494d57a76

MISRA C++, AUTOSAR C++について

https://qiita.com/kaizen_nagoya/items/3436fbd49865e0da7d35

## 応用例2　MISRA C/C++

MISRA C まとめ #include <misra_c.h>

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

MISRA C++ 5-0-16

https://qiita.com/kaizen_nagoya/items/7df2d4e05db724752a74

## 応用例3 CERT C/C++

SEI CERT C++ Coding Standard AA. Bibliography 確認中。

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

MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする

https://qiita.com/kaizen_nagoya/items/8dff19511e42b2593db1

## 応用例4 箱庭　
 箱庭もくもく会 

https://hakoniwa.connpass.com

第11回 未定

箱庭ではUnityをはじめC++を使っているらしい。　

ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。

この項目は、箱庭プロジェクトを市場分析の対象として、原則的には、箱庭プロジェクトの外部から分析し、外部から箱庭の広告宣伝のための戦略会議を仮想した結果、仮想「箱庭もくもく会」を開催してみることを企画するものである。　
一切の内容は、箱庭プロジェクト、Athrill, TOPPERSとは無関係である。　
一(いち)参加データアナリストの、個人的なつぶやきです。

仮想戦略会議「箱庭」

https://qiita.com/kaizen_nagoya/items/73cb132707653176a461

お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる（１）

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

お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる（2）

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


## 自己参考資料(self 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/kaizen_nagoya/items/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

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

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