はじめに(Introduction)
N4910 Working Draft, Standard for Programming Language C++
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++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに1回は、該当するエラーが検索できます。
ただ、条件が違っていて、そこでの修正方法では目的を達成しないこともしばしばです。いろいろな条件のコンパイルエラーとその対応方法について、広く記録することによって、いつか同じエラーに遭遇した時にやくに立つことを目指しています。
この半年の間で、三度、自分のネットでの記録に助けられたことがあります。
また過去に解決できなかった記録を10種類以上、最近になって解決できたことがあります。それは、主に次の3つの情報に基づいています。
cpprefjp - C++日本語リファレンス
コンパイラの実装状況
また
https://researchmap.jp/joub9b3my-1797580/#_1797580
に記載したサイトのお世話になっています。
作業方針(sequence)
Clang++では-std=c++03, C++2bの2種類
g++では-std=c++03, c++2bの2種類
でコンパイルし、
1)コンパイルエラーを収集する。
2)コンパイルエラーをなくす方法を検討する。
コンパイルエラーになる例を示すだけが目的のコードは、コンパイルエラーをなくすのではなく、コンパイルエラーの種類を収集するだけにする。
文法を示すのが目的のコード場合に、コンパイルエラーをなくすのに手間がかかる場合は、順次作業します。
3)リンクエラーをなくす方法を検討する。
文法を示すのが目的のコード場合に、リンクエラーをなくすのに手間がかかる場合は、順次作業します。
4)意味のある出力を作る。
コンパイル、リンクが通っても、意味のある出力を示そうとすると、コンパイル・リンクエラーが出て収拾できそうにない場合がある。順次作業します。
1)だけのものから4)まで進んだものと色々ある状態です。一歩でも前に進むご助言をお待ちしています。「検討事項」の欄に現状を記録するようにしています。
C++N4910:2022 Standard Working Draft on ISO/IEC 14882(0) sample code compile list
C++N4741, 2018 Standard Working Draft on ISO/IEC 14882 sample code compile list
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++
編纂器(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.
30.4 Standard locale categories [locale.categories] C++N4910:2022 (683) p1454.cpp
算譜(source code)
// 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 = "30.4 Standard locale categories [locale.categories] C++N4910:2022 (683) p1454.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;
// 30.4.1 General
// Each of the standard categories includes a family of facets. Some of these implement formatting or parsing of a datum, for use by standard or users’ iostream operators << and >>, as members put() and get(), respectively. Each such member function takes an ios_base& argument whose members flags(), precision(), and width(), specify the format of the corresponding datum (31.5.2). Those functions which need to use other facets call its member getloc() to retrieve the locale imbued there. Formatting facets use the character argument fill to fill out the specified width where necessary.
// The put() members make no provision for error reporting. (Any failures of the OutputIterator argument can be extracted from the returned iterator.) The get() members take an ios_base::iostate& argument whose value they ignore, but set to ios_base::failbit in case of a parse error.
// 249) When used in a loop, it is faster to cache the ctype<> facet and use it directly, or use the vector form of ctype<>::is.
// Within subclause 30.4 it is unspecified whether one virtual function calls another virtual function.
// 30.4.2 The ctype category [category.ctype]
// 30.4.2.1 General [category.ctype.general]
namespace std {
class ctype_base {
public:
using mask = see_below;
// numeric values are for exposition only.
static const mask space = 1 << 0;
static const mask print = 1 << 1;
static const mask cntrl = 1 << 2;
static const mask upper = 1 << 3;
static const mask lower = 1 << 4;
static const mask alpha = 1 << 5;
static const mask digit = 1 << 6;
static const mask punct = 1 << 7;
static const mask xdigit = 1 << 8;
static const mask blank = 1 << 9;
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
};
}
// The type mask is a bitmask type (16.3.3.3.4).
// 30.4.2.2 Class template ctype [locale.ctype]
// 30.4.2.2.1 General [locale.ctype.general]
namespace std {
template<class charT>
class ctype : public locale::facet, public ctype_base {
public:
using char_type = charT;
explicit ctype(size_t refs = 0);
bool is(mask m, charT c) const;
const charT* is(const charT* low, const charT* high, mask* vec) const;
const charT* scan_is(mask m, const charT* low, const charT* high) const;
const charT* scan_not(mask m, const charT* low, const charT* high) const;
charT toupper(charT c) const;
const charT* toupper(charT* low, const charT* high) const;
charT tolower(charT c) const;
const charT* tolower(charT* low, const charT* high) const;
charT widen(char c) const;
const char* widen(const char* low, const char* high, charT* to) const;
char narrow(charT c, char dfault) const;
const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const;
static locale::id id;
protected:
~ctype();
virtual bool do_is(mask m, charT c) const;
virtual const charT* do_is(const charT* low, const charT* high, mask* vec) const;
virtual const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
virtual const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
virtual charT do_toupper(charT) const;
virtual const charT* do_toupper(charT* low, const charT* high) const;
virtual charT do_tolower(charT) const;
virtual const charT* do_tolower(charT* low, const charT* high) const;
const charT* narrow(const charT* low, const charT* high, char dfault, char* to) const;
virtual charT do_widen(char) const;
virtual const char* do_widen(const char* low, const char* high, charT* dest) const;
virtual char do_narrow(charT, char dfault) const;
virtual const charT* do_narrow(const charT* low, const charT* high,
char dfault, char* dest) const;
};
}
// Class ctype encapsulates the C library <cctype> features. istream members are required to use ctype<> for character classing during input parsing.
// The specializations required in Table 100 (30.3.1.2.1), namely ctype<char> and ctype<wchar_t>, implement character classing appropriate to the implementation’s native character set.
// 30.4.2.2.2 ctype members [locale.ctype.members]
bool is(mask m, charT c) const;
const charT* is(const charT* low, const charT* high, mask* vec) const;
// Returns: do_is(m, c) or do_is(low, high, vec).
const charT* scan_is(mask m, const charT* low, const charT* high) const;
// Returns: do_scan_is(m, low, high).
const charT* scan_not(mask m, const charT* low, const charT* high) const;
// Returns: do_scan_not(m, low, high). charT toupper(charT) const;
const charT* toupper(charT* low, const charT* high) const;
// Returns: do_toupper(c) or do_toupper(low, high). charT tolower(charT c) const;
const charT* tolower(charT* low, const charT* high) const;
// Returns: do_tolower(c) or do_tolower(low, high). charT widen(char c) const;
const char* widen(const char* low, const char* high, charT* to) const;
// Returns: do_widen(c) or do_widen(low, high, to). char narrow(charT c, char dfault) const;
// Returns: do_narrow(c, dfault) or do_narrow(low, high, dfault, to). // 30.4.2.2.3 ctype virtual functions [locale.ctype.virtuals]
bool do_is(mask m, charT c) const;
const charT* do_is(const charT* low, const charT* high, mask* vec) const;
// Effects: Classifies a character or sequence of characters. For each argument character, identifies a value M of type ctype_base::mask. The second form identifies a value M of type ctype_base::mask for each *p where (low <= p && p < high), and places it into vec[p - low].
// Returns: The first form returns the result of the expression (M & m) != 0; i.e., true if the character has the characteristics specified. The second form returns high.
const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
// Effects: Locates a character in a buffer that conforms to a classification m.
// Returns: The smallest pointer p in the range [low,high) such that is(m, *p) would return true; otherwise, returns high.
const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
// Effects: Locates a character in a buffer that fails to conform to a classification m.
// Returns: The smallest pointer p, if any, in the range [low,high) such that is(m, *p) would return
false;
otherwise, returns high.
// Effects: Applies the simplest reasonable transformation from a charT value or sequence of charT values to the corresponding char value or values.
// For any character c in the basic character set (5.3) the transformation is such that do_widen(do_narrow(c, 0)) == c
//For any named ctype category with a ctype<char> facet ctc however, and ctype_base::mask value M, (is(M, c) || !ctc.is(M, do_narrow(c, dfault)) ) is true (unless do_narrow returns dfault). In addition, for any digit character c, the expression (do_- narrow(c, dfault) - ’0’) evaluates to the digit value of the character. The second form transforms each character *p in the range [low, high), placing the result (or dfault if no simple transformation is readily available) in dest[p - low].
// Returns: The first form returns the transformed value; or dfault if no mapping is readily available. The second form returns high.
charT do_toupper(charT c) const;
const charT* do_toupper(charT* low, const charT* high) const;
// Effects: Converts a character or characters to upper case. The second form replaces each character *p in the range [low, high) for which a corresponding upper-case character exists, with that character.
// Returns: The first form returns the corresponding upper-case character if it is known to exist, or its argument if not. The second form returns high.
charT
const charT* do_tolower(charT* low, const charT* high) const;
do_tolower(charT c) const;
// Effects: Converts a character or characters to lower case. The second form replaces each character *p in the range [low, high) and for which a corresponding lower-case character exists, with that character.
// Returns: The first form returns the corresponding lower-case character if it is known to exist, or its argument if not. The second form returns high.
charT
const char* do_widen(const char* low, const char* high, charT* dest) const;
do_widen(char c) const;
// Effects: Applies the simplest reasonable transformation from a char value or sequence of char values to the corresponding charT value or values.250 The only characters for which unique transformations are required are those in the basic character set (5.3). For any named ctype category with a ctype<charT> facet ctc and valid ctype_base::mask value M, (ctc.is(M, c) || !is(M, do_widen(c)) ) is true.
// The second form transforms each character *p in the range [low, high), placing the result in dest[p - low].
// Returns: The first form returns the transformed value. The second form returns high. do_narrow(charT c, char dfault) const;
char
const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const;
// 30.4.2.3 Class template ctype_byname [locale.ctype.byname]
namespace std {
template<class charT>
class ctype_byname : public ctype<charT> {
public:
using mask = typename ctype<charT>::mask;
explicit ctype_byname(const char*, size_t refs = 0);
explicit ctype_byname(const string&, size_t refs = 0);
protected:
~ctype_byname();
// 250) The parameter c of do_widen is intended to accept values derived from character-literals for conversion to the locale’s encoding.
// 251) In other words, the transformed character is not a member of any character classification that c is not also a member of.
};
}
// 30.4.2.4 ctype<char> specialization [facet.ctype.special]
// 30.4.2.4.1 General [facet.ctype.special.general]
namespace std {
template<>
class ctype<char> : public locale::facet, public ctype_base {
public:
using char_type = char;
explicit ctype(const mask* tab = nullptr, bool del = false, size_t refs = 0);
bool is(mask m, char c) const;
const char* is(const char* low, const char* high, mask* vec) const;
const char* scan_is (mask m, const char* low, const char* high) const;
const char* scan_not(mask m, const char* low, const char* high) const;
char toupper(char c) const;
const char* toupper(char* low, const char* high) const;
char tolower(char c) const;
const char* tolower(char* low, const char* high) const;
char widen(char c) const;
const char* widen(const char* low, const char* high, char* to) const;
char narrow(char c, char dfault) const;
const char* narrow(const char* low, const char* high, char dfault, char* to) const;
static locale::id id;
static const size_t table_size = implementation-defined;
const mask* table() const noexcept;
static const mask* classic_table() noexcept;
protected:
~ctype();
virtual char do_toupper(char c) const;
virtual const char* do_toupper(char* low, const char* high) const;
virtual char do_tolower(char c) const;
virtual const char* do_tolower(char* low, const char* high) const;
virtual char do_widen(char c) const;
virtual const char* do_widen(const char* low, const char* high, char* to) const;
virtual char do_narrow(char c, char dfault) const;
virtual const char* do_narrow(const char* low, const char* high,
char dfault, char* to) const;
};
}
// A specialization ctype<char> is provided so that the member functions on type char can be implemented inline.252 The implementation-defined value of member table_size is at least 256.
// 30.4.2.4.2 Destructor [facet.ctype.char.dtor]
~ctype();
// Effects: If the constructor’s first argument was nonzero, and its second argument was true, does delete
[] table().
// 252) Only the char (not unsigned char and signed char) form is provided. The specialization is specified in the standard, and not left as an implementation detail, because it affects the derivation interface for ctype<char>.
// Preconditions: Either tbl == nullptr is true or [tbl, tbl+table_size) is a valid range. Effects: Passes its refs argument to its base class constructor.
// 30.4.2.4.3 Members [facet.ctype.char.members]
// In the following member descriptions, for unsigned char values v where v >= table_size, table()[v] is assumed to have an implementation-specific value (possibly different for each such value v) without performing the array lookup.
explicit ctype(const mask* tbl = nullptr, bool del = false, size_t refs = 0);
bool is(mask m, char c) const;
const char* is(const char* low, const char* high, mask* vec) const;
// Effects: The second form, for all *p in the range [low,high), assigns into vec[p - low] the value table()[(unsigned char)*p].
// Returns: The first form returns table()[(unsigned char)c] & m; the second form returns high.
const char* scan_is(mask m, const char* low, const char* high) const;
// Returns: The smallest p in the range [low, high) such that table()[(unsigned char) *p] & m
is true.
const char* scan_not(mask m, const char* low, const char* high) const;
// Returns: The smallest p in the range [low, high) such that table()[(unsigned char) *p] & m
is false.
char toupper(char c) const;
const char* toupper(char* low, const char* high) const;
// Returns: do_toupper(c) or do_toupper(low, high), respectively. char tolower(char c) const;
const char* tolower(char* low, const char* high) const;
// Returns: do_tolower(c) or do_tolower(low, high), respectively. char widen(char c) const;
const char* widen(const char* low, const char* high, char* to) const;
// Returns: do_widen(c) or do_widen(low, high, to), respectively. char narrow(char c, char dfault) const;
const char* narrow(const char* low, const char* high, char dfault, char* to) const;
// Returns: do_narrow(c, dfault) or do_narrow(low, high, dfault, to), respectively. const mask* table() const noexcept;
// Returns: The first constructor argument, if it was nonzero, otherwise classic_table().
// 30.4.2.4.4 Static members [facet.ctype.char.statics]
static const mask* classic_table() noexcept;
// Returns: A pointer to the initial element of an array of size table_size which represents the classifica- tions of characters in the "C" locale.
// 30.4.2.4.5 Virtual functions [facet.ctype.char.virtuals]
char do_toupper(char) const;
const char* do_toupper(char* low, const char* high) const;
char do_tolower(char) const;
const char* do_tolower(char* low, const char* high) const;
virtual char do_widen(char c) const;
virtual const char* do_widen(const char* low, const char* high, char* to) const;
virtual char do_narrow(char c, char dfault) const;
virtual const char* do_narrow(const char* low, const char* high,
char dfault, char* to) const;
// These functions are described identically as those members of the same name in the ctype class template (30.4.2.2.2).
// 30.4.2.5 Class template codecvt [locale.codecvt]
// 30.4.2.5.1 General [locale.codecvt.general]
namespace std {
class codecvt_base {
public:
enum result { ok, partial, error, noconv };
};
template<class internT, class externT, class stateT>
class codecvt : public locale::facet, public codecvt_base {
public:
using intern_type = internT;
using extern_type = externT;
using state_type = stateT;
explicit codecvt(size_t refs = 0);
result out(
stateT& state,
const internT* from, const internT* from_end, const internT*& from_next,
externT* to,
result unshift(
stateT& state,
externT* to,
externT*
externT*
to_end, externT*&
to_end, externT*&
to_next) const;
to_next) const;
result in(
stateT& state,
const externT* from, const externT* from_end, const externT*& from_next,
internT* to, internT* to_end, internT*& to_next) const;
int encoding() const noexcept;
bool always_noconv() const noexcept;
int length(stateT&, const externT* from, const externT* end, size_t max) const;
int max_length() const noexcept;
static locale::id id;
protected:
~codecvt();
virtual result do_out(
stateT& state,
const internT* from, const internT* from_end, const internT*& from_next,
externT* to, externT* to_end, externT*& to_next) const;
virtual result do_in(
stateT& state,
const externT* from, const externT* from_end, const externT*& from_next,
internT* to, internT* to_end, internT*&
virtual result do_unshift(
stateT& state,
externT* to, externT* to_end, externT*&
to_next) const;
to_next) const;
virtual int do_encoding() const noexcept;
virtual bool do_always_noconv() const noexcept;
virtual int do_length(stateT&, const externT* from, const externT* end, size_t max) const;
// Preconditions: (from <= from_end && to <= to_end) is well-defined and true; state is initialized, if at the beginning of a sequence, or else is equal to the result of converting the preceding characters in the sequence.
virtual int do_max_length() const noexcept;
};
}
// The class codecvt<internT, externT, stateT> is for use when converting from one character encoding to another, such as from wide characters to multibyte characters or between wide character encodings such as UTF-32 and EUC.
// The stateT argument selects the pair of character encodings being mapped between.
// The specializations required in Table 100 (30.3.1.2.1) convert the implementation-defined native character set. codecvt<char, char, mbstate_t> implements a degenerate conversion; it does not convert at all. The specialization codecvt<char16_t, char8_t, mbstate_t> converts between the UTF-16 and UTF-8 encoding forms, and the specialization codecvt <char32_t, char8_t, mbstate_t> converts between the UTF-32 and UTF-8 encoding forms. codecvt<wchar_t, char, mbstate_t> converts between the native character sets for ordinary and wide characters. Specializations on mbstate_t perform conversion between encodings known to the library implementer. Other encodings can be converted by specializing on a program- defined stateT type. Objects of type stateT can contain any state that is useful to communicate to or from the specialized do_in or do_out members.
result out(
stateT& state,
const internT* from, const internT* from_end, const internT*& from_next,
externT* to, externT* to_end, externT*& to_next) const;
// Returns: do_out(state, from, from_end, from_next, to, to_end, to_next). result unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
// 30.4.2.5.2 Members [locale.codecvt.members]
// Returns: do_unshift(state, to, to_end, to_next).
result in(
stateT& state,
const externT* from, const externT* from_end, const externT*& from_next,
internT* to, internT* to_end, internT*& to_next) const;
// Returns: do_in(state, from, from_end, from_next, to, to_end, to_next). int encoding() const noexcept;
// Returns: do_encoding().
bool always_noconv() const noexcept;
// Returns: do_always_noconv().
int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
// Returns: do_length(state, from, from_end, max). int max_length() const noexcept;
// Returns: do_max_length().
// 30.4.2.5.3 Virtual functions [locale.codecvt.virtuals]
result do_out(
stateT& state,
const internT* from, const internT* from_end, const internT*& from_next,
externT* to, externT* to_end, externT*& to_next) const;
result do_in(
stateT& state,
const externT* from, const externT* from_end, const externT*& from_next,
internT* to, internT* to_end, internT*& to_next) const;
// Effects: Translates characters in the source range [from, from_end), placing the results in sequential positions starting at destination to. Converts no more than (from_end - from) source elements, and stores no more than (to_end - to) destination elements.
// Stops if it encounters a character it cannot convert. It always leaves the from_next and to_next pointers pointing one beyond the last element successfully converted. If returns noconv, internT and externT are the same type and the converted sequence is identical to the input sequence [from,from_next). to_next is set equal to to, the value of state is unchanged, and there are no changes to the values in [to, to_end).
// A codecvt facet that is used by basic_filebuf (31.10) shall have the property that if do_out(state, from, from_end, from_next, to, to_end, to_next) would return ok, where from != from_end, then do_out(state, from, from + 1, from_next, to, to_end, to_next) shall also return ok, and that if do_in(state, from, from_end, from_next, to, to_end, to_next) would return ok, where to != to_end, then do_in(state, from, from_end, from_next, to, to + 1, to_next) shall also return ok.
// [Note 1: As a result of operations on state, it can return ok or partial and set from_next == from and to_next != to.
// Returns: An enumeration value, as summarized in Table 102.
// Table 102: do_in/do_out result values [tab:locale.codecvt.inout]
// A return value of partial, if (from_next == from_end), indicates that either the destination sequence has not absorbed all the available destination elements, or that additional source elements are needed before another destination element can be produced.
// Remarks: Its operations on state are unspecified.
// [Note 2: This argument can be used, for example, to maintain shift state, to specify conversion options (such as count only), or to identify a cache of seek offsets.
result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
// Value Meaning ok partial error noconv completed the conversion not all source characters converted encountered a character in [from, from_end) that cannot be converted internT and externT are the same type, and input sequence is identical to converted sequence
// Preconditions: (to <= to_end) is well-defined and true; state is initialized, if at the beginning of a sequence, or else is equal to the result of converting the preceding characters in the sequence.
// Effects: Places characters starting at to that should be appended to terminate a sequence when the current stateT is given by state.254 Stores no more than (to_end - to) destination elements, and leaves the to_next pointer pointing one beyond the last element successfully stored.
// Returns: An enumeration value, as summarized in Table 103.
// 253) Informally, this means that basic_filebuf assumes that the mappings from internal to external characters is 1 to N: that a codecvt facet that is used by basic_filebuf can translate characters one internal character at a time.
// 254) Typically these will be characters to return the state to stateT().
// Table 103: do_unshift result values [tab:locale.codecvt.unshift] Value Meaning ok partial error noconv completed the sequence space for more than to_end - to destination elements was needed to terminate a sequence given the value of state an unspecified error has occurred no termination is needed for this state_type
int do_encoding() const noexcept;
// Returns: -1 if the encoding of the externT sequence is state-dependent; else the constant number of externT characters needed to produce an internal character; or 0 if this number is not a constant.255
bool do_always_noconv() const noexcept;
// Returns: true if do_in() and do_out() return noconv for all valid argument values. codecvt<char, char, mbstate_t> returns true.
int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
// Preconditions: (from <= from_end) is well-defined and true; state is initialized, if at the beginning of a sequence, or else is equal to the result of converting the preceding characters in the sequence.
// Effects: The effect on the state argument is as if it called do_in(state, from, from_end, from, to, to+max, to) for to pointing to a buffer of at least max elements.
// Returns: (from_next-from) where from_next is the largest value in the range [from, from_end] such that the sequence of values in the range [from,from_next) represents max or fewer valid complete characters of type internT. The specialization codecvt<char, char, mbstate_t>, returns the lesser of max and (from_end-from).
int do_max_length() const noexcept;
// Returns: The maximum value that do_length(state, from, from_end, 1) can return for any valid range [from, from_end) and stateT value state. The specialization codecvt<char, char, mbstate_- t>::do_max_length() returns 1.
// 30.4.2.6 Class template codecvt_byname [locale.codecvt.byname]
namespace std {
template<class internT, class externT, class stateT>
class codecvt_byname : public codecvt<internT, externT, stateT> {
public:
explicit codecvt_byname(const char*, size_t refs = 0);
explicit codecvt_byname(const string&, size_t refs = 0);
protected:
~codecvt_byname();
};
}
// 30.4.3 The numeric category [category.numeric]
// 30.4.3.1 General [category.numeric.general]
// The classes num_get<> and num_put<> handle numeric formatting and parsing. Virtual functions are provided for several numeric types. Implementations may (but are not required to) delegate extraction of smaller types to extractors for larger types.256
// 255) If encoding() yields -1, then more than max_length() externT elements can be consumed when producing a single internT character, and additional externT elements can appear at the end of a sequence after those that yield the final internT character. 256) Parsing "-1" correctly into, e.g., an unsigned short requires that the corresponding member get() at least extract the sign before delegating.
// All specifications of member functions for num_put and num_get in the subclauses of 30.4.3 only apply to the specializations required in Tables 100 and 101 (30.3.1.2.1), namely num_get<char>, num_get<wchar_t>, num_- get<C, InputIterator>, num_put<char>, num_put<wchar_t>, and num_put<C, OutputIterator>. These specializations refer to the ios_base& argument for formatting specifications (30.4), and to its imbued locale for the numpunct<> facet to identify all numeric punctuation preferences, and also for the ctype<> facet to perform character classification.
// Extractor and inserter members of the standard iostreams use num_get<> and num_put<> member functions for formatting and parsing numeric values (31.7.4.3.1, 31.7.5.3.1).
// 30.4.3.2 Class template num_get [locale.num.get]
// 30.4.3.2.1 General [locale.num.get.general]
namespace std {
template<class charT, class InputIterator = istreambuf_iterator<charT>>
class num_get : public locale::facet {
public:
using char_type = charT;
using iter_type = InputIterator;
explicit num_get(size_t refs = 0);
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, bool& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, long& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, long long& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned short& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned int& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned long& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, unsigned long long& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, float& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, double& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, long double& v) const;
iter_type get(iter_type in, iter_type end, ios_base&,
ios_base::iostate& err, void*& v) const;
static locale::id id;
protected:
~num_get();
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, bool& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, long& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, long long& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned short& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned int& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned long& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, unsigned long long& v) const;
// Returns: do_get(in, end, str, err, val).
// 30.4.3.2.3 Virtual functions
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned short& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned int& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long long& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, float& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, double& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long double& val) const;
iter_type do_get(iter_type in, iter_type end, ios_base& str,
// Effects: Reads characters from in, interpreting them according to str.flags(), use_facet<ctype< charT>>(loc), and use_facet<numpunct<charT>>(loc), where loc is str.getloc().
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, float& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, double& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, long double& v) const;
virtual iter_type do_get(iter_type, iter_type, ios_base&,
ios_base::iostate& err, void*& v) const;
};
}
// The facet num_get is used to parse numeric values from an input sequence such as an istream.
// 30.4.3.2.2 Members
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, bool& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned short& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned int& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, unsigned long long& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, float& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, double& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, long double& val) const;
iter_type get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, void*& val) const;
// [facet.num.get.members]
ios_base::iostate& err, void*& val) const;
// The details of this operation occur in three stages
// [facet.num.get.virtuals]
// — Stage 1: Determine a conversion specifier
// — Stage 2: Extract characters from in and determine a corresponding char value for the format expected by the conversion specification determined in stage 1.
// — Stage 3: Store results
// The details of the stages are presented below.
// Stage 1: The function initializes local variables via
fmtflags flags = str.flags();
fmtflags basefield = (flags & ios_base::basefield);
fmtflags uppercase = (flags & ios_base::uppercase);
fmtflags boolalpha = (flags & ios_base::boolalpha);
// For conversion to an integral type, the function determines the integral conversion specifier as indicated in Table 104. The table is ordered. That is, the first line whose condition is true applies.
// Table 104: Integer conversions [tab:facet.num.get.int]
// For conversions to a floating-point type the specifier is %g.
// For conversions to void* the specifier is %p.
// A length modifier is added to the conversion specification, if needed, as indicated in Table 105.
// Table 105: Length modifier [tab:facet.num.get.length]
// Stage 2: If in == end then stage 2 terminates. Otherwise a charT is taken from in and local variables are initialized as if by
char_type ct = *in;
char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
if (ct == use_facet<numpunct<charT>>(loc).decimal_point())
c = '.';
bool discard =
ct == use_facet<numpunct<charT>>(loc).thousands_sep()
&& use_facet<numpunct<charT>>(loc).grouping().length() != 0;
// where the values src and atoms are defined as if by:
static const char src[] = "0123456789abcdefpxABCDEFPX+-";
char_type atoms[sizeof(src)];
use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
// for this value of loc.
// If discard is true, then if ’.’ has not yet been accumulated, then the position of the character is remembered, but the character is otherwise ignored. Otherwise, if ’.’ has already been accumulated, the character is discarded and Stage 2 terminates. If it is not discarded, then a check is made to determine if c is allowed as the next character of an input field of the conversion specifier returned by Stage 1. If so, it is accumulated.
// If the character is either discarded or accumulated then in is advanced by ++in and processing returns to the beginning of stage 2.
// [Example 1: Given an input sequence of "0x1a.bp+07p",
// — if the conversion specifier returned by Stage 1 is %d, "0" is accumulated;
// — if the conversion specifier returned by Stage 1 is %i, "0x1a" are accumulated;
// — if the conversion specifier returned by Stage 1 is %g, "0x1a.bp+07" are accumulated.
// In all cases, the remainder is left in the input. —end example]
// Stage 3: The sequence of chars accumulated in stage 2 (the field) is converted to a numeric value by the rules of one of the functions declared in the header <cstdlib>:
// — For a signed integer value, the function strtoll.
// — For an unsigned integer value, the function strtoull.
// — For a float value, the function strtof.
// — For a double value, the function strtod.
// — For a long double value, the function strtold.
// The numeric value to be stored can be one of:
// — zero, if the conversion function does not convert the entire field.
// — the most positive (or negative) representable value, if the field to be converted to a signed integer type represents a value too large positive (or negative) to be represented in val.
// — the most positive representable value, if the field to be converted to an unsigned integer type represents a value that cannot be represented in val.
// — the converted value, otherwise.
//The resultant numeric value is stored in val. If the conversion function does not convert the entire field, or if the field represents a value outside the range of representable values, ios_base::failbit is assigned to err. Digit grouping is checked. That is, the positions of discarded separators are examined for consistency with use_facet<numpunct<charT>>(loc).grouping(). If they are not consistent then ios_base::failbit is assigned to err. In any case, if stage 2 processing was terminated by the test for in == end then err |= ios_- base::eofbit is performed. iter_type do_get(iter_type in, iter_type end, ios_base& str,
ios_base::iostate& err, bool& val) const;
// Effects: If (str.flags()&ios_base::boolalpha) == 0 then input proceeds as it would for a long except that if a value is being stored into val, the value is determined according to the following: If the value to be stored is 0 then false is stored. If the value is 1 then true is stored. Otherwise true is stored and ios_base::failbit is assigned to err.
// Otherwise target sequences are determined “as if” by calling the members falsename() and truename() of the facet obtained by use_facet<numpunct<charT>>(str.getloc()). Successive characters in the range [in, end) (see 24.2.4) are obtained and matched against corresponding positions in the target sequences only as necessary to identify a unique match. The input iterator in is compared to end only when necessary to obtain a character. If a target sequence is uniquely matched, val is set to the corresponding value. Otherwise false is stored and ios_base::failbit is assigned to err.
// The in iterator is always left pointing one position beyond the last character successfully matched. If val is set, then err is set to str.goodbit; or to str.eofbit if, when seeking another character to match, it is found that (in == end). If val is not set, then err is set to str.failbit; or to (str.failbit|str.eofbit) if the reason for the failure was that (in == end).
// [Example 2: For targets true: "a" and false: "abb", the input sequence "a" yields val == true and err == str.eofbit; the input sequence "abc" yields err = str.failbit, with in ending at the ’c’ element. For targets true: "1" and false: "0", the input sequence "1" yields val == true and err == str.goodbit. For empty targets (""), any input sequence yields err == str.failbit.
// Returns: in.
// Returns: do_put(out, str, fill, val).
// 30.4.3.3 Class template num_put [locale.nm.put]
// 30.4.3.3.1 General [locale.nm.put.general]
namespace std {
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
class num_put : public locale::facet {
public:
using char_type = charT;
using iter_type = OutputIterator;
explicit num_put(size_t refs = 0);
iter_type put(iter_type s, ios_base& f, char_type fill, bool v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, long v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, long long v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, unsigned long long v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, double v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, long double v) const;
iter_type put(iter_type s, ios_base& f, char_type fill, const void* v) const;
static locale::id id;
protected:
~num_put();
virtual iter_type do_put(iter_type, ios_base&, char_type fill, bool v) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long v) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long long v) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, unsigned long long) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, double v) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, long double v) const;
virtual iter_type do_put(iter_type, ios_base&, char_type fill, const void* v) const;
};
}
// The facet num_put is used to format numeric values to a character sequence such as an ostream.
// 30.4.3.3.2 Members [facet.num.put.members]
iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, double val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, long double val) const;
iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
// 30.4.3.3.3 Virtual functions [facet.num.put.virtuals]
iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
// Effects: Writes characters to the sequence out, formatting val as desired. In the following description, loc names a local variable initialized as
locale loc = str.getloc();
// The details of this operation occur in several stages:
// — Stage 1: Determine a printf conversion specifier spec and determine the characters that would be printed by printf (31.13) given this conversion specifier for printf(spec, val) assuming that the current locale is the "C" locale.
// — Stage 2: Adjust the representation by converting each char determined by stage 1 to a charT using a conversion and values returned by members of use_facet<numpunct<charT>>(loc). — Stage 3: Determine where padding is required.
// — Stage 4: Insert the sequence into the out.
// Detailed descriptions of each stage follow. Returns: out.
// Stage 1: The first action of stage 1 is to determine a conversion specifier. The tables that describe this determination use the following local variables
fmtflags flags = str.flags();
fmtflags basefield = (flags & (ios_base::basefield));
fmtflags uppercase = (flags & (ios_base::uppercase));
fmtflags floatfield = (flags & (ios_base::floatfield));
fmtflags showpos = (flags & (ios_base::showpos));
fmtflags showbase = (flags & (ios_base::showbase));
fmtflags showpoint = (flags & (ios_base::showpoint));
// All tables used in describing stage 1 are ordered. That is, the first line whose condition is true applies. A line without a condition is the default behavior when none of the earlier lines apply. For conversion from an integral type other than a character type, the function determines the integral conversion specifier as indicated in Table 106.
// Table 106: Integer conversions [tab:facet.num.put.int]
// For conversion from a floating-point type, the function determines the floating-point conversion specifier as indicated in Table 107.
// Table 107: Floating-point conversions [tab:facet.num.put.fp]
// For conversions from an integral or floating-point type a length modifier is added to the conversion specifier as indicated in Table 108.
// The conversion specifier has the following optional additional qualifiers prepended as indicated in Table 109.
// For conversion from a floating-point type, if floatfield != (ios_base::fixed | ios_base:: scientific), str.precision() is specified as precision in the conversion specification. Otherwise, no precision is specified.
// Table 108: Length modifier [tab:facet.num.put.length]
// Table 109: Numeric conversions [tab:facet.num.put.conv]
// For conversion from void* the specifier is %p.
// The representations at the end of stage 1 consists of the char’s that would be printed by a call of printf(s, val) where s is the conversion specifier determined above.
// Stage 2: Any character c other than a decimal point(.) is converted to a charT via use_facet<ctype<charT>>(loc).widen(c)
// A local variable punct is initialized via
const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
// For arithmetic types, punct.thousands_sep() characters are inserted into the sequence as deter- mined by the value returned by punct.do_grouping() using the method described in 30.4.4.1.3. Decimal point characters(.) are replaced by punct.decimal_point().
// Stage 3: A local variable is initialized as
fmtflags adjustfield = (flags & (ios_base::adjustfield));
// The location of any padding257 is determined according to Table 110. // Table 110: Fill padding [tab:facet.num.put.fill]
// Type Length modifier
// otherwise none
// stage 1 began with 0x or 0X otherwise pad before
// If str.width() is nonzero and the number of charT’s in the sequence after stage 2 is less than str.width(), then enough fill characters are added to the sequence at the position indicated for padding to bring the length of the sequence to str.width(). str.width(0) is called.
// Stage 4: The sequence of charT’s at the end of stage 3 are output via *out++ = c
// 257) The conversion specification #o generates a leading 0 which is not a padding character.
iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;
// Returns: If (str.flags() & ios_base::boolalpha) == 0 returns do_put(out, str, fill, (int)val), otherwise obtains a string s as if by
string_type s =
val ? use_facet<numpunct<charT>>(loc).truename()
: use_facet<numpunct<charT>>(loc).falsename();
// and then inserts each character c of s into out via *out++ = c and returns out.
// 30.4.4 The numeric punctuation facet [facet.numpunct]
// 30.4.4.1 Class template numpunct [locale.numpunct]
// 30.4.4.1.1 General [locale.numpunct.general]
namespace std {
template<class charT>
class numpunct : public locale::facet {
public:
using char_type = charT;
using string_type = basic_string<charT>;
explicit numpunct(size_t refs = 0);
const;
const;
const;
const;
const;
char_type
char_type
string
string_type truename()
string_type falsename()
static locale::id id;
protected:
~numpunct();
virtual char_type virtual char_type virtual string virtual string_type virtual string_type
};
}
do_decimal_point() const;
do_thousands_sep() const;
// virtual
// for bool // for bool
decimal_point()
thousands_sep()
grouping()
do_grouping()
do_truename()
do_falsename()
const;
const;
const;
// numpunct<> specifies numeric punctuation. The specializations required in Table 100 (30.3.1.2.1), namely numpunct<wchar_t> and numpunct<char>, provide classic "C" numeric formats, i.e., they contain information equivalent to that contained in the "C" locale or their wide character counterparts as if obtained by a call to widen.
// The syntax for number formats is as follows, where digit represents the radix set specified by the fmtflags argument value, and thousands-sep and decimal-point are the results of corresponding numpunct<charT> members. Integer values have the format:
// intval : signopt units
// sign : + -
// units : digits digits thousands-sep units digits : digit digitsopt
// and floating-point values have:
// floatval : signopt units fractionalopt exponentopt signopt decimal-point digits exponentopt
// Returns: do_truename() or do_falsename(), respectively.
// 30.4.4.1.3 Virtual functions
char_type do_decimal_point() const;
// [facet.numpunct.virtuals]
// fractional : decimal-point digitsopt exponent :e signopt digits e: e E
// where the number of digits between thousands-seps is as specified by do_grouping(). For parsing, if the digits portion contains no thousands-separators, no grouping constraint is applied.
// 30.4.4.1.2 Members
char_type decimal_point() const;
// Returns: do_decimal_point(). char_type thousands_sep() const;
// Returns: do_thousands_sep(). string grouping() const;
// Returns: do_grouping(). string_type truename() const;
string_type falsename() const;
[facet.numpunct.members]
// Returns: A character for use as the decimal radix separator. The required specializations return ’.’ or L’.’.
char_type do_thousands_sep() const;
// Returns: A character for use as the digit group separator. The required specializations return ’,’ or L’,’.
string do_grouping() const;
// Returns: A string vec used as a vector of integer values, in which each element vec[i] represents the number of digits258 in the group at position i, starting with position 0 as the rightmost group. If vec.size() <= i, the number is the same as group (i - 1); if (i < 0 || vec[i] <= 0 || vec[i] == CHAR_MAX), the size of the digit group is unlimited.
// The required specializations return the empty string, indicating no grouping.
string_type do_truename() const;
string_type do_falsename() const;
// Returns: A string representing the name of the boolean value true or false, respectively.
// In the base class implementation these names are "true" and "false", or L"true" and L"false".
// 30.4.4.2 Class template numpunct_byname [locale.numpunct.byname]
namespace std {
template<class charT>
class numpunct_byname : public numpunct<charT> { // this class is specialized for char and wchar_t. public:
using char_type = charT;
using string_type = basic_string<charT>;
// 258) Thus, the string "\003" specifies groups of 3 digits each, and "3" probably indicates groups of 51 (!) digits each, because 51 is the ASCII value of "3".
// [locale.collate.virtuals]
explicit numpunct_byname(const char*, size_t refs = 0);
explicit numpunct_byname(const string&, size_t refs = 0);
protected:
~numpunct_byname();
};
}
// 30.4.5 The collate category [category.collate]
// 30.4.5.1 Class template collate [locale.collate]
// 30.4.5.1.1 General [locale.collate.general]
namespace std {
template<class charT>
class collate : public locale::facet {
public:
using char_type = charT;
using string_type = basic_string<charT>;
explicit collate(size_t refs = 0);
int compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const;
string_type transform(const charT* low, const charT* high) const;
long hash(const charT* low, const charT* high) const;
static locale::id id;
protected:
~collate();
virtual int do_compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const;
virtual string_type do_transform(const charT* low, const charT* high) const;
virtual long do_hash (const charT* low, const charT* high) const;
};
}
// The class collate<charT> provides features for use in the collation (comparison) and hashing of strings. A locale member function template, operator(), uses the collate facet to allow a locale to act directly as the predicate argument for standard algorithms (Clause 27) and containers operating on strings. The specializations required in Table 100 (30.3.1.2.1), namely collate<char> and collate<wchar_t>, apply lexicographic ordering (27.8.11).
// Each function compares a string of characters *p in the range [low, high).
// 30.4.5.1.2 Members [locale.collate.members]
int compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const;
// Returns: do_compare(low1, high1, low2, high2). string_type transform(const charT* low, const charT* high) const;
// Returns: do_transform(low, high).
long hash(const charT* low, const charT* high) const;
// Returns: do_hash(low, high).
// 30.4.5.1.3 Virtual functions
int do_compare(const charT* low1, const charT* high1,
const charT* low2, const charT* high2) const;
// Returns: 1 if the first string is greater than the second, -1 if less, zero otherwise. The specializations required in Table 100 (30.3.1.2.1), namely collate<char> and collate<wchar_t>, implement a lexicographical comparison (27.8.11).
string_type do_transform(const charT* low, const charT* high) const;
// Returns: A basic_string<charT> value that, compared lexicographically with the result of calling transform() on another string, yields the same result as calling do_compare() on the same two strings.259
long do_hash(const charT* low, const charT* high) const;
// Returns: An integer value equal to the result of calling hash() on any other string for which do_- compare() returns 0 (equal) when passed the two strings.
Recommended practice:
The probability that the result equals that for another string which does not compare equal should be very small, approaching (1.0/numeric_limits<unsigned long>::max()).
// 30.4.5.2 Class template collate_byname [locale.collate.byname]
namespace std {
template<class charT>
class collate_byname : public collate<charT> {
public:
using string_type = basic_string<charT>;
explicit collate_byname(const char*, size_t refs = 0);
explicit collate_byname(const string&, size_t refs = 0);
protected:
~collate_byname();
};
}
// 30.4.6 The time category [category.time]
// 30.4.6.1 General [category.time.general]
// Templates time_get<charT, InputIterator> and time_put<charT, OutputIterator> provide date and time formatting and parsing. All specifications of member functions for time_put and time_get in the subclauses of 30.4.6 only apply to the specializations required in Tables 100 and 101 (30.3.1.2.1). Their members use their ios_base&, ios_base::iostate&, and fill arguments as described in 30.4, and the ctype<> facet, to determine formatting details.
// 30.4.6.2 Class template time_get [locale.time.get]
// 30.4.6.2.1 General [locale.time.get.general]
namespace std {
class time_base {
public:
enum dateorder { no_order, dmy, mdy, ymd, ydm };
};
template<class charT, class InputIterator = istreambuf_iterator<charT>>
class time_get : public locale::facet, public time_base {
public:
using char_type = charT;
using iter_type = InputIterator;
explicit time_get(size_t refs = 0);
dateorder date_order() const {
return do_date_order();
}
iter_type get_time(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_date(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_weekday(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get_monthname(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
// 259) This function is useful when one string is being compared to many other strings.
// Returns: do_get_time(s, end, str, err, t).
iter_type get_date(iter_type s, iter_type end, ios_base& str,
iter_type get_year(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t) const;
iter_type get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, char format, char modifier = 0) const;
iter_type get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, const char_type* fmt,
const char_type* fmtend) const;
static locale::id id;
protected:
~time_get();
virtual dateorder do_date_order() const;
virtual iter_type do_get_time(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const;
virtual iter_type do_get_date(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const;
virtual iter_type do_get_weekday(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const;
virtual iter_type do_get_monthname(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const;
virtual iter_type do_get_year(iter_type s, iter_type end, ios_base&,
ios_base::iostate& err, tm* t) const;
virtual iter_type do_get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, char format, char modifier) const;
};
}
// time_get is used to parse a character sequence, extracting components of a time or date into a tm object. Each get member parses a format as produced by a corresponding format specifier to time_put<>::put. If the sequence being parsed matches the correct format, the corresponding members of the tm argument are set to the values used to produce the sequence; otherwise either an error is reported or unspecified values are assigned.260
// If the end iterator is reached during parsing by any of the get() member functions, the member sets ios_base::eofbit in err.
// 30.4.6.2.2 Members [locale.time.get.members]
dateorder date_order() const;
// Returns: do_date_order().
iter_type get_time(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
ios_base::iostate& err, tm* t) const;
// Returns: do_get_date(s, end, str, err, t).
iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
// Returns: do_get_weekday(s, end, str, err, t) or do_get_monthname(s, end, str, err, t). iter_type get_year(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
// Returns: do_get_year(s, end, str, err, t).
// 260) In other words, user confirmation is required for reliable parsing of user-entered dates and times, but machine-generated formats can be parsed reliably. This allows parsers to be aggressive about interpreting user variations on standard formats.
iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
tm* t, char format, char modifier = 0) const;
// Returns: do_get(s, end, f, err, t, format, modifier).
iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
tm* t, const char_type* fmt, const char_type* fmtend) const;
// Preconditions: [fmt, fmtend) is a valid range.
// Effects: The function starts by evaluating err = ios_base::goodbit. It then enters a loop, reading zero or more characters from s at each iteration. Unless otherwise specified below, the loop terminates when the first of the following conditions holds:
// — The expression fmt == fmtend evaluates to true.
// — The expression err == ios_base::goodbit evaluates to false.
// — The expression s == end evaluates to true, in which case the function evaluates err = ios_- base::eofbit | ios_base::failbit.
// — The next element of fmt is equal to ’%’, optionally followed by a modifier character, followed by a conversion specifier character, format, together forming a conversion specification valid for the POSIX function strptime. If the number of elements in the range [fmt, fmtend) is not sufficient to unambiguously determine whether the conversion specification is complete and valid, the function evaluates err = ios_base::failbit. Otherwise, the function evaluates s = do_get(s, end, f, err, t, format, modifier), where the value of modifier is ’\0’ when the optional modifier is absent from the conversion specification. If err == ios_base::goodbit holds after the evaluation of the expression, the function increments fmt to point just past the end of the conversion specification and continues looping.
// — The expression isspace(*fmt, f.getloc()) evaluates to true, in which case the function first increments fmt until fmt == fmtend || !isspace(*fmt, f.getloc()) evaluates to true, then advances s until s == end || !isspace(*s, f.getloc()) is true, and finally resumes looping.
// — The next character read from s matches the element pointed to by fmt in a case-insensitive comparison, in which case the function evaluates ++fmt, ++s and continues looping. Otherwise, the function evaluates err = ios_base::failbit.
// [Note 1: The function uses the ctype<charT> facet installed in f’s locale to determine valid whitespace characters. It is unspecified by what means the function performs case-insensitive comparison or whether multi-character sequences are considered while doing so.
// Returns: s.
// 30.4.6.2.3 Virtual functions [locale.time.get.virtuals]
dateorder do_date_order() const;
// Returns: An enumeration value indicating the preferred order of components for those date formats that are composed of day, month, and year.261 Returns no_order if the date format specified by ’x’ contains other variable components (e.g., Julian day, week number, week day).
iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
// Effects: Reads characters starting at s until it has extracted those tm members, and remaining format characters, used by time_put<>::put to produce the format specified by "%H:%M:%S", or until it encounters an error or end of sequence.
// Returns: An iterator pointing immediately beyond the last character recognized as possibly part of a valid time.
iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
// Effects: Reads characters starting at s until it has extracted those tm members and remaining format characters used by time_put<>::put to produce one of the following formats, or until it encounters an error. The format depends on the value returned by date_order() as shown in Table 111.
// 261) This function is intended as a convenience only, for common formats, and can return no_order in valid locales.
date_order() Format
no_order "%m%d%y" dmy "%d%m%y" mdy "%m%d%y" ymd "%y%m%d" ydm "%y%d%m"
// Table 111: do_get_date effects [tab:locale.time.get.dogetdate]
// An implementation may also accept additional implementation-defined formats.
// Returns: An iterator pointing immediately beyond the last character recognized as possibly part of a valid date.
iter_type do_get_weekday(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
// Effects: Reads characters starting at s until it has extracted the (perhaps abbreviated) name of a weekday or month. If it finds an abbreviation that is followed by characters that can match a full name, it continues reading until it matches the full name or fails. It sets the appropriate tm member accordingly.
// Returns: An iterator pointing immediately beyond the last character recognized as part of a valid name. iter_type do_get_year(iter_type s, iter_type end, ios_base& str,
ios_base::iostate& err, tm* t) const;
// Effects: Reads characters starting at s until it has extracted an unambiguous year identifier. It is implementation-defined whether two-digit year numbers are accepted, and (if so) what century they are assumed to lie in. Sets the t->tm_year member accordingly.
// Returns: An iterator pointing immediately beyond the last character recognized as part of a valid year identifier.
iter_type do_get(iter_type s, iter_type end, ios_base& f,
ios_base::iostate& err, tm* t, char format, char modifier) const;
// Preconditions: t points to an object.
// Effects: The function starts by evaluating err = ios_base::goodbit. It then reads characters starting at s until it encounters an error, or until it has extracted and assigned those tm members, and any remaining format characters, corresponding to a conversion specification appropriate for the POSIX function strptime, formed by concatenating ’%’, the modifier character, when non-NUL, and the format character. When the concatenation fails to yield a complete valid directive the function leaves the object pointed to by t unchanged and evaluates err |= ios_base::failbit. When s == end evaluates to true after reading a character the function evaluates err |= ios_base::eofbit.
// For complex conversion specifications such as %c, %x, or %X, or conversion specifications that involve the optional modifiers E or O, when the function is unable to unambiguously determine some or all tm members from the input sequence [s, end), it evaluates err |= ios_base::eofbit. In such cases the values of those tm members are unspecified and may be outside their valid range.
// Returns: An iterator pointing immediately beyond the last character recognized as possibly part of a valid input sequence for the given format and modifier.
// Remarks: It is unspecified whether multiple calls to do_get() with the address of the same tm object will update the current contents of the object or simply overwrite its members. Portable programs should zero out the object before invoking the function.
// 30.4.6.3 Class template time_get_byname [locale.time.get.byname]
namespace std {
template<class charT, class InputIterator = istreambuf_iterator<charT>>
class time_get_byname : public time_get<charT, InputIterator> {
// Effects: The first form steps through the sequence from pattern to pat_end, identifying characters that are part of a format sequence. Each character that is not part of a format sequence is written to s immediately, and each format sequence, as it is identified, results in a call to do_put; thus, format elements and other characters are interleaved in the output in the order in which they appear in the pattern. Format sequences are identified by converting each character c to a char value as if by ct.narrow(c, 0), where ct is a reference to ctype<charT> obtained from str.getloc(). The first character of each sequence is equal to ’%’, followed by an optional modifier character mod262 and a format specifier character spec as defined for the function strftime. If no modifier character is present, mod is zero. For each valid format sequence identified, calls do_put(s, str, fill, t, spec, mod).
// The second form calls do_put(s, str, fill, t, format, modifier).
// [Note 1: The fill argument can be used in the implementation-defined formats or by derivations. A space character is a reasonable default for this argument. —end note]
// Returns: An iterator pointing immediately after the last character produced.
public:
using dateorder = time_base::dateorder;
using iter_type = InputIterator;
explicit time_get_byname(const char*, size_t refs = 0);
explicit time_get_byname(const string&, size_t refs = 0);
protected:
~time_get_byname();
};
}
// 30.4.6.4 Class template time_put
namespace std {
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
class time_put : public locale::facet {
public:
using char_type = charT;
using iter_type = OutputIterator;
explicit time_put(size_t refs = 0);
// the following is implemented in terms of other member functions.
iter_type put(iter_type s, ios_base& f, char_type fill, const tm* tmb,
const charT* pattern, const charT* pat_end) const;
iter_type put(iter_type s, ios_base& f, char_type fill,
const tm* tmb, char format, char modifier = 0) const;
static locale::id id;
protected:
~time_put();
virtual iter_type do_put(iter_type s, ios_base&, char_type, const tm* t,
char format, char modifier) const;
[locale.time.put]
};
}
// 30.4.6.4.1 Members [locale.time.put.members]
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
const charT* pattern, const charT* pat_end) const;
iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
char format, char modifier = 0) const;
// 262) Although the C programming language defines no modifiers, most vendors do.
// 30.4.6.4.2 Virtual functions [locale.time.put.virtuals]
iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
char format, char modifier) const;
// Effects: Formats the contents of the parameter t into characters placed on the output sequence s. Formatting is controlled by the parameters format and modifier, interpreted identically as the format specifiers in the string argument to the standard library function strftime(), except that the sequence of characters produced for those specifiers that are described as depending on the C locale are instead implementation-defined.
// [Note 1: Interpretation of the modifier argument is implementation-defined.
// Returns: An iterator pointing immediately after the last character produced.
// [Note 2: The fill argument can be used in the implementation-defined formats or by derivations. A space character is a reasonable default for this argument.
// Recommended practice: Interpretation of the modifier should follow POSIX conventions. Implemen- tations should refer to other standards such as POSIX for a specification of the character sequences produced for those specifiers described as depending on the C locale.
// 30.4.6.5 Class template time_put_byname [locale.time.put.byname]
namespace std {
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
class time_put_byname : public time_put<charT, OutputIterator> {
public:
using char_type = charT;
using iter_type = OutputIterator;
explicit time_put_byname(const char*, size_t refs = 0);
explicit time_put_byname(const string&, size_t refs = 0);
protected:
~time_put_byname();
};
}
// 30.4.7 The monetary category [category.monetary]
// 30.4.7.1 General [category.monetary.general]
// These templates handle monetary formats. A template parameter indicates whether local or international monetary formats are to be used.
// All specifications of member functions for money_put and money_get in the subclauses of 30.4.7 only apply to the specializations required in Tables 100 and 101 (30.3.1.2.1). Their members use their ios_base&, ios_base::iostate&, and fill arguments as described in 30.4, and the moneypunct<> and ctype<> facets, to determine formatting details.
// 30.4.7.2 Class template money_get [locale.money.get]
namespace std {
template<class charT, class InputIterator = istreambuf_iterator<charT>>
class money_get : public locale::facet {
public:
using char_type = charT;
using iter_type = InputIterator;
using string_type = basic_string<charT>;
explicit money_get(size_t refs = 0);
iter_type get(iter_type s, iter_type end, bool intl,
ios_base& f, ios_base::iostate& err,
long double& units) const;
iter_type get(iter_type s, iter_type end, bool intl,
ios_base& f, ios_base::iostate& err,
string_type& digits) const;
};
}
// 30.4.7.2.1 Members [locale.money.get.members]
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
ios_base::iostate& err, long double& quant) const;
iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
ios_base::iostate& err, string_type& quant) const;
// Returns: do_get(s, end, intl, f, err, quant).
// 30.4.7.2.2 Virtual functions [locale.money.get.virtuals]
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
ios_base::iostate& err, long double& units) const;
iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
ios_base::iostate& err, string_type& digits) const;
// Effects: Reads characters from s to parse and construct a monetary value according to the format specified by a moneypunct<charT, Intl> facet reference mp and the character mapping specified by a ctype<charT> facet reference ct obtained from the locale returned by str.getloc(), and str.flags(). If a valid sequence is recognized, does not change err; otherwise, sets err to (err|str.failbit), or (err|str.failbit|str.eofbit) if no more characters are available, and does not change units or digits. Uses the pattern returned by mp.neg_format() to parse all values. The result is returned as an integral value stored in units or as a sequence of digits possibly preceded by a minus sign (as produced by ct.widen(c) where c is ’-’ or in the range from ’0’ through ’9’ (inclusive)) stored in digits.
// [Example 1: The sequence $1,056.23 in a common United States locale would yield, for units, 105623, or, for digits, "105623".
// If mp.grouping() indicates that no thousands separators are permitted, any such characters are not read, and parsing is terminated at the point where they first appear. Otherwise, thousands separators are optional; if present, they are checked for correct placement only after all format components have been read.
// Where money_base::space or money_base::none appears as the last element in the format pattern, no whitespace is consumed. Otherwise, where money_base::space appears in any of the initial elements of the format pattern, at least one whitespace character is required. Where money_base::none appears in any of the initial elements of the format pattern, whitespace is allowed but not required. If (str.flags() & str.showbase) is false, the currency symbol is optional and is consumed only if other characters are needed to complete the format; otherwise, the currency symbol is required.
// If the first character (if any) in the string pos returned by mp.positive_sign() or the string neg returned by mp.negative_sign() is recognized in the position indicated by sign in the format pattern, it is consumed and any remaining characters in the string are required after all the other format components.
// [Example 2: If showbase is off, then for a neg value of "()" and a currency symbol of "L", in "(100 L)" the "L" is consumed; but if neg is "-", the "L" in "-100 L" is not consumed.
// If pos or neg is empty, the sign component is optional, and if no sign is detected, the result is given the sign that corresponds to the source of the empty string. Otherwise, the character in the indicated position must match the first character of pos or neg, and the result is given the corresponding sign. If the first character of pos is equal to the first character of neg, or if both strings are empty, the result is given a positive sign.
static locale::id id;
protected:
~money_get();
virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
ios_base::iostate& err, long double& units) const;
virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
ios_base::iostate& err, string_type& digits) const;
// Digits in the numeric monetary component are extracted and placed in digits, or into a character buffer buf1 for conversion to produce a value for units, in the order in which they appear, preceded by a minus sign if and only if the result is negative. The value units is produced as if by263
for (int i = 0; i < n; ++i)
buf2[i] = src[find(atoms, atoms+sizeof(src), buf1[i]) - atoms];
buf2[n] = 0;
sscanf(buf2, "%Lf", &units);
// where n is the number of characters placed in buf1, buf2 is a character buffer, and the values src and atoms are defined as if by
static const char src[] = "0123456789-";
charT atoms[sizeof(src)];
ct.widen(src, src + sizeof(src) - 1, atoms);
// Returns: An iterator pointing immediately beyond the last character recognized as part of a valid monetary quantity.
// Returns: do_put(s, intl, f, loc, quant).
// 30.4.7.3 Class template money_put [locale.money.put]
namespace std {
template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
class money_put : public locale::facet {
public:
using char_type = charT;
using iter_type = OutputIterator;
using string_type = basic_string<charT>;
explicit money_put(size_t refs = 0);
iter_type put(iter_type s, bool intl, ios_base& f,
char_type fill, long double units) const;
iter_type put(iter_type s, bool intl, ios_base& f,
char_type fill, const string_type& digits) const;
static locale::id id;
protected:
~money_put();
virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill,
long double units) const;
virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill,
};
}
// 30.4.7.3.1 Members [locale.money.put.members]
const string_type& digits) const;
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
// 30.4.7.3.2 Virtual functions [locale.money.put.virtuals]
iter_type do_put(iter_type s, bool intl, ios_base& str,
char_type fill, long double units) const;
iter_type do_put(iter_type s, bool intl, ios_base& str,
char_type fill, const string_type& digits) const;
//Effects: Writes characters to s according to the format specified by a moneypunct<charT, Intl> facet reference mp and the character mapping specified by a ctype<charT> facet reference ct obtained from the locale returned by str.getloc(), and str.flags(). The argument units is transformed into a sequence of wide characters as if by
ct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2)
// 263) The semantics here are different from ct.narrow.
//for character buffers buf1 and buf2. If the first character in digits or buf2 is equal to ct.widen(’-’), then the pattern used for formatting is the result of mp.neg_format(); otherwise the pattern is the result of mp.pos_format(). Digit characters are written, interspersed with any thousands separators and decimal point specified by the format, in the order they appear (after the optional leading minus sign) in digits or buf2. In digits, only the optional leading minus sign and the immediately subsequent digit characters (as classified according to ct) are used; any trailing characters (including digits appearing after a non-digit character) are ignored. Calls str.width(0).
// Returns: An iterator pointing immediately after the last character produced.
// Remarks: The currency symbol is generated if and only if (str.flags() & str.showbase) is nonzero. If the number of characters generated for the specified format is less than the value returned by str.width() on entry to the function, then copies of fill are inserted as necessary to pad to the speci- fied width. For the value af equal to (str.flags() & str.adjustfield), if (af == str.internal) is true, the fill characters are placed where none or space appears in the formatting pattern; otherwise if (af == str.left) is true, they are placed after the other characters; otherwise, they are placed before the other characters.
// [Note 1: It is possible, with some combinations of format patterns and flag values, to produce output that cannot be parsed using num_get<>::get.
// 30.4.7.4 Class template moneypunct [locale.moneypunct]
// 30.4.7.4.1 General [locale.moneypunct.general]
namespace std {
class money_base {
public:
enum part { none, space, symbol, sign, value };
struct pattern {
char field[4];
};
};
template<class charT, bool International = false>
class moneypunct : public locale::facet, public money_base {
public:
using char_type = charT;
using string_type = basic_string<charT>;
explicit moneypunct(size_t refs = 0);
};
}
charT
charT
string
string_type curr_symbol() const;
string_type positive_sign() const;
string_type negative_sign() const;
int frac_digits() const;
pattern pos_format() const;
pattern neg_format() const;
decimal_point() const;
thousands_sep() const;
grouping() const;
static locale::id id;
static const bool intl = International;
protected:
~moneypunct();
virtual charT
virtual charT
virtual string
virtual string_type do_curr_symbol() const;
virtual string_type do_positive_sign() const;
virtual string_type do_negative_sign() const;
virtual int do_frac_digits() const;
virtual pattern do_pos_format() const;
virtual pattern do_neg_format() const;
do_decimal_point() const;
do_thousands_sep() const;
do_grouping() const;
// The moneypunct<> facet defines monetary formatting parameters used by money_get<> and money_put<>. A monetary format is a sequence of four components, specified by a pattern value p, such that the part value static_cast<part>(p.field[i]) determines the ith component of the format264 In the field member of a pattern object, each value symbol, sign, value, and either space or none appears exactly once. The value none, if present, is not first; the value space, if present, is neither first nor last.
// Where none or space appears, whitespace is permitted in the format, except where none appears at the end, in which case no whitespace is permitted. The value space indicates that at least one space is required at that position. Where symbol appears, the sequence of characters returned by curr_symbol() is permitted, and can be required. Where sign appears, the first (if any) of the sequence of characters returned by positive_sign() or negative_sign() (respectively as the monetary value is non-negative or negative) is required. Any remaining characters of the sign sequence are required after all other format components. Where value appears, the absolute numeric monetary value is required.
// The format of the numeric monetary value is a decimal number:
//value : units fractionalopt decimal-point digits fractional : decimal-point digitsopt if frac_digits() returns a positive value, or value : units otherwise. The symbol decimal-point indicates the character returned by decimal_point(). The other symbols are defined as follows: units : digits digits thousands-sep units digits : adigit digitsopt
// In the syntax specification, the symbol adigit is any of the values ct.widen(c) for c in the range ’0’ through ’9’ (inclusive) and ct is a reference of type const ctype<charT>& obtained as described in the definitions of money_get<> and money_put<>. The symbol thousands-sep is the character returned by thousands_sep(). The space character used is the value ct.widen(’ ’). Whitespace characters are those characters c for which ci.is(space, c) returns true. The number of digits required after the decimal point (if any) is exactly the value returned by frac_digits().
// The placement of thousands-separator characters (if any) is determined by the value returned by grouping(),
// Each of these functions F returns the result of calling the corresponding virtual member function do_F ().
// 30.4.7.4.3 Virtual functions [locale.moneypunct.virtuals]
charT do_decimal_point() const;
// Returns: The radix separator to use in case do_frac_digits() is greater than zero.265 264) An array of char, rather than an array of part, is specified for pattern::field purely for efficiency.
// 265) In common U.S. locales this is ’.’.
defined identically as the member numpunct<>::do_grouping().
// 30.4.7.4.2 Members [locale.moneypunct.members]
charT
charT
string
string_type curr_symbol() const;
string_type positive_sign() const;
string_type negative_sign() const;
int frac_digits() const;
pattern pos_format() const;
pattern neg_format() const;
decimal_point() const;
thousands_sep() const;
grouping() const;
charT do_thousands_sep() const;
// Returns: The digit group separator to use in case do_grouping() specifies a digit grouping pattern.266 string do_grouping() const;
// Returns: A pattern defined identically as, but not necessarily equal to, the result of numpunct<charT>:: do_grouping().267
string_type do_curr_symbol() const;
// Returns: A string to use as the currency identifier symbol.
// [Note 1: For specializations where the second template parameter is true, this is typically four characters long: a three-letter code as specified by ISO 4217 followed by a space. —end note]
string_type do_positive_sign() const;
string_type do_negative_sign() const;
// Returns: do_positive_sign() returns the string to use to indicate a positive monetary value;268 do_negative_sign() returns the string to use to indicate a negative value.
int do_frac_digits() const;
// Returns: The number of digits after the decimal radix separator, if any.269 pattern do_pos_format() const;
pattern do_neg_format() const;
// Returns: The specializations required in Table 101 (30.3.1.2.1), namely — moneypunct<char>,
// — moneypunct<wchar_t>,
// — moneypunct<char, true>, and
// — moneypunct<wchar_t, true>,
return an object of type pattern initialized to { symbol, sign, none, value }.270
// 30.4.7.5 Class template moneypunct_byname [locale.moneypunct.byname]
namespace std {
template<class charT, bool Intl = false>
class moneypunct_byname : public moneypunct<charT, Intl> {
public:
using pattern = money_base::pattern;
using string_type = basic_string<charT>;
explicit moneypunct_byname(const char*, size_t refs = 0);
explicit moneypunct_byname(const string&, size_t refs = 0);
protected:
~moneypunct_byname();
};
}
// 30.4.8 The message retrieval category
// 30.4.8.1 General
// Class messages<charT> implements retrieval of strings from message catalogs.
// 266) In common U.S. locales this is ’,’.
// 267) To specify grouping by 3s, the value is "\003" not "3".
// 268) This is usually the empty string.
// 269) In common U.S. locales, this is 2.
// 270) Note that the international symbol returned by do_curr_symbol() usually contains a space, itself; for example, "USD ".
// 30.4.8.2 Class template messages [category.messages]
// 30.4.8.2.1 General [category.messages.general]
namespace std {
class messages_base {
public:
using catalog = unspecified signed integer type;
};
template<class charT>
class messages : public locale::facet, public messages_base {
public:
using char_type = charT;
using string_type = basic_string<charT>;
explicit messages(size_t refs = 0);
catalog open(const string& fn, const locale&) const;
string_type get(catalog c, int set, int msgid,
const string_type& dfault) const;
void close(catalog c) const;
static locale::id id;
protected:
~messages();
virtual catalog do_open(const string&, const locale&) const;
virtual string_type do_get(catalog, int set, int msgid,
const string_type& dfault) const;
virtual void do_close(catalog) const;
};
}
// [locale.messages] [locale.messages.general]
// Values of type messages_base::catalog usable as arguments to members get and close can be obtained only by calling member open.
// 30.4.8.2.2 Members [locale.messages.members]
catalog open(const string& name, const locale& loc) const;
// Returns: do_open(name, loc).
string_type get(catalog cat, int set, int msgid, const string_type& dfault) const;
// Returns: do_get(cat, set, msgid, dfault). void close(catalog cat) const;
// Effects: Calls do_close(cat).
// 30.4.8.2.3 Virtual functions [locale.messages.virtuals]
catalog do_open(const string& name, const locale& loc) const;
// Returns: A value that may be passed to get() to retrieve a message from the message catalog identified by the string name according to an implementation-defined mapping. The result can be used until it is passed to close().
// Returns a value less than 0 if no such catalog can be opened.
// Remarks: The locale argument loc is used for character set code conversion when retrieving messages, if needed.
string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const;
// Preconditions: cat is a catalog obtained from open() and not yet closed.
// Returns: A message identified by arguments set, msgid, and dfault, according to an implementation- defined mapping. If no such message can be found, returns dfault.
void do_close(catalog cat) const;
// Preconditions: cat is a catalog obtained from open() and not yet closed. Effects: Releases unspecified resources associated with cat.
// Remarks: The limit on such resources, if any, is implementation-defined.
// 30.4.8.3 Class template messages_byname
namespace std {
template<class charT>
class messages_byname : public messages<charT> {
public:
using catalog = messages_base::catalog;
using string_type = basic_string<charT>;
explicit messages_byname(const char*, size_t refs = 0);
explicit messages_byname(const string&, size_t refs = 0);
protected:
~messages_byname();
};
}
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p1454.cpp -std=03 -o p1454l -I. -Wall
In file included from p1454.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 \
^
p1454.cpp:22:14: error: redefinition of 'ctype_base'
class ctype_base {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/ctype_base.h:41:10: note: previous definition is here
struct ctype_base
^
p1454.cpp:44:16: error: redefinition of 'ctype'
class ctype : public locale::facet, public ctype_base {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_facets.h:612:11: note: previous definition is here
class ctype : public __ctype_abstract_base<_CharT>
^
p1454.cpp:79:9: error: unknown type name 'mask'
bool is(mask m, charT c) const;
^
p1454.cpp:79:17: error: unknown type name 'charT'; did you mean 'char'?
bool is(mask m, charT c) const;
^~~~~
char
p1454.cpp:79:26: error: non-member function cannot have 'const' qualifier
bool is(mask m, charT c) const;
^~~~~
p1454.cpp:80:7: error: unknown type name 'charT'; did you mean 'char'?
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
char
p1454.cpp:80:23: error: unknown type name 'charT'; did you mean 'char'?
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
char
p1454.cpp:80:41: error: unknown type name 'charT'; did you mean 'char'?
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
char
p1454.cpp:80:54: error: unknown type name 'mask'
const charT* is(const charT* low, const charT* high, mask* vec) const;
^
p1454.cpp:80:65: error: non-member function cannot have 'const' qualifier
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
p1454.cpp:82:7: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:82:22: error: unknown type name 'mask'
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^
p1454.cpp:82:36: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:82:54: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:82:67: error: non-member function cannot have 'const' qualifier
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
p1454.cpp:84:7: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:84:23: error: unknown type name 'mask'
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^
p1454.cpp:84:37: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^~~~~
char
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p1454.cpp -std=2b -o p1454l -I. -Wall
p1454.cpp:22:14: error: redefinition of 'ctype_base'
class ctype_base {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/x86_64-linux-gnu/c++/10/bits/ctype_base.h:41:10: note: previous definition is here
struct ctype_base
^
p1454.cpp:44:16: error: redefinition of 'ctype'
class ctype : public locale::facet, public ctype_base {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/locale_facets.h:612:11: note: previous definition is here
class ctype : public __ctype_abstract_base<_CharT>
^
p1454.cpp:79:9: error: unknown type name 'mask'
bool is(mask m, charT c) const;
^
p1454.cpp:79:17: error: unknown type name 'charT'; did you mean 'char'?
bool is(mask m, charT c) const;
^~~~~
char
p1454.cpp:79:26: error: non-member function cannot have 'const' qualifier
bool is(mask m, charT c) const;
^~~~~
p1454.cpp:80:7: error: unknown type name 'charT'; did you mean 'char'?
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
char
p1454.cpp:80:23: error: unknown type name 'charT'; did you mean 'char'?
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
char
p1454.cpp:80:41: error: unknown type name 'charT'; did you mean 'char'?
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
char
p1454.cpp:80:54: error: unknown type name 'mask'
const charT* is(const charT* low, const charT* high, mask* vec) const;
^
p1454.cpp:80:65: error: non-member function cannot have 'const' qualifier
const charT* is(const charT* low, const charT* high, mask* vec) const;
^~~~~
p1454.cpp:82:7: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:82:22: error: unknown type name 'mask'
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^
p1454.cpp:82:36: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:82:54: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:82:67: error: non-member function cannot have 'const' qualifier
const charT* scan_is(mask m, const charT* low, const charT* high) const;
^~~~~
p1454.cpp:84:7: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:84:23: error: unknown type name 'mask'
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^
p1454.cpp:84:37: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^~~~~
char
p1454.cpp:84:55: error: unknown type name 'charT'; did you mean 'char'?
const charT* scan_not(mask m, const charT* low, const charT* high) const;
^~~~~
char
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++ p1454.cpp -std=03 -o p1454g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p1454.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 \
| ^~~~~
p1454.cpp:144:45: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++11-compat]
144 | explicit ctype(const mask* tab = nullptr, bool del = false, size_t refs = 0);
| ^~~~~~~
p1454.cpp:159:38: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
159 | const mask* table() const noexcept;
| ^~~~~~~~
p1454.cpp:22:14: error: redefinition of 'class std::ctype_base'
22 | class ctype_base {
| ^~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/bits/locale_facets.h:41,
from /usr/local/include/c++/12.1.0/bits/basic_ios.h:37,
from /usr/local/include/c++/12.1.0/ios:44,
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/x86_64-linux-gnu/bits/ctype_base.h:41:10: note: previous definition of 'class std::ctype_base'
41 | struct ctype_base
| ^~~~~~~~~~
p1454.cpp:44:16: error: redefinition of 'class std::ctype<_CharT>'
44 | class ctype : public locale::facet, public ctype_base {
| ^~~~~
/usr/local/include/c++/12.1.0/bits/locale_facets.h:615:11: note: previous definition of 'class std::ctype<_CharT>'
615 | class ctype : public __ctype_abstract_base<_CharT>
| ^~~~~
p1454.cpp:79:9: error: 'mask' was not declared in this scope
79 | bool is(mask m, charT c) const;
| ^~~~
p1454.cpp:79:17: error: 'charT' was not declared in this scope; did you mean 'char'?
79 | bool is(mask m, charT c) const;
| ^~~~~
| char
p1454.cpp:79:24: error: expression list treated as compound expression in initializer [-fpermissive]
79 | bool is(mask m, charT c) const;
| ^
p1454.cpp:80:7: error: 'charT' does not name a type; did you mean 'char'?
80 | const charT* is(const charT* low, const charT* high, mask* vec) const;
| ^~~~~
| char
p1454.cpp:82:7: error: 'charT' does not name a type; did you mean 'char'?
82 | const charT* scan_is(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:84:7: error: 'charT' does not name a type; did you mean 'char'?
84 | const charT* scan_not(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:86:7: error: 'charT' does not name a type; did you mean 'char'?
86 | const charT* toupper(charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:88:7: error: 'charT' does not name a type; did you mean 'char'?
88 | const charT* tolower(charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:90:54: error: 'charT' has not been declared
90 | const char* widen(const char* low, const char* high, charT* to) const;
| ^~~~~
p1454.cpp:90:65: error: non-member function 'const char* widen(const char*, const char*, int*)' cannot have cv-qualifier
90 | const char* widen(const char* low, const char* high, charT* to) const;
| ^~~~~
p1454.cpp:93:20: error: 'mask' was not declared in this scope
93 | bool do_is(mask m, charT c) const;
| ^~~~
p1454.cpp:93:28: error: 'charT' was not declared in this scope; did you mean 'char'?
93 | bool do_is(mask m, charT c) const;
| ^~~~~
| char
p1454.cpp:93:35: error: expression list treated as compound expression in initializer [-fpermissive]
93 | bool do_is(mask m, charT c) const;
| ^
p1454.cpp:94:7: error: 'charT' does not name a type; did you mean 'char'?
94 | const charT* do_is(const charT* low, const charT* high, mask* vec) const;
| ^~~~~
| char
p1454.cpp:97:7: error: 'charT' does not name a type; did you mean 'char'?
97 | const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:100:7: error: 'charT' does not name a type; did you mean 'char'?
100 | const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:103:1: error: expected unqualified-id before 'false'
103 | false; otherwise, returns high.
| ^~~~~
p1454.cpp:103:8: error: 'otherwise' does not name a type
103 | false; otherwise, returns high.
| ^~~~~~~~~
p1454.cpp:109:10: error: 'charT' does not name a type; did you mean 'char'?
109 | const charT* do_toupper(charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:112:1: error: 'charT' does not name a type; did you mean 'char'?
112 | charT
| ^~~~~
| char
p1454.cpp:114:11: error: expected constructor, destructor, or type conversion before '(' token
114 | do_tolower(charT c) const;
| ^
p1454.cpp:117:1: error: 'charT' does not name a type; did you mean 'char'?
117 | charT
| ^~~~~
| char
p1454.cpp:119:23: error: expected constructor, destructor, or type conversion before ';' token
119 | do_widen(char c) const;
| ^
p1454.cpp:124:12: error: expected initializer before '*' token
124 | const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const;
| ^
p1454.cpp:128:13: error: redefinition of 'class std::ctype_byname<_CharT>'
128 | class ctype_byname : public ctype<charT> {
| ^~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/locale_facets.h:1486:11: note: previous definition of 'class std::ctype_byname<_CharT>'
1486 | class ctype_byname : public ctype<_CharT>
| ^~~~~~~~~~~~
p1454.cpp:141:13: error: redefinition of 'class std::ctype<char>'
141 | class ctype<char> : public locale::facet, public ctype_base {
| ^~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/locale_facets.h:689:11: note: previous definition of 'class std::ctype<char>'
689 | class ctype<char> : public locale::facet, public ctype_base
| ^~~~~~~~~~~
p1454.cpp:174:7: error: expected class-name before '(' token
174 | ~ctype();
| ^
p1454.cpp:176:1: error: expected unqualified-id before '[' token
176 | [] table().
| ^
p1454.cpp:182:13: error: redefinition of 'bool is'
182 | bool is(mask m, char c) const;
| ^~
p1454.cpp:79:6: note: 'bool is' previously defined here
79 | bool is(mask m, charT c) const;
| ^~
p1454.cpp:182:16: error: 'mask' was not declared in this scope
182 | bool is(mask m, char c) const;
| ^~~~
p1454.cpp:182:24: error: expected primary-expression before 'char'
182 | bool is(mask m, char c) const;
| ^~~~
p1454.cpp:183:51: error: 'mask' has not been declared
183 | const char* is(const char* low, const char* high, mask* vec) const;
| ^~~~
p1454.cpp:183:62: error: non-member function 'const char* is(const char*, const char*, int*)' cannot have cv-qualifier
183 | const char* is(const char* low, const char* high, mask* vec) const;
| ^~~~~
p1454.cpp:183:62: error: 'const char* is(const char*, const char*, int*)' redeclared as different kind of entity
p1454.cpp:79:6: note: previous declaration 'bool is'
79 | bool is(mask m, charT c) const;
| ^~
p1454.cpp:186:21: error: 'mask' was not declared in this scope
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^~~~
p1454.cpp:186:29: error: expected primary-expression before 'const'
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^~~~~
p1454.cpp:186:46: error: expected primary-expression before 'const'
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^~~~~
p1454.cpp:186:62: error: expression list treated as compound expression in initializer [-fpermissive]
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^
p1454.cpp:188:1: error: 'is' does not name a type
188 | is true.
| ^~
p1454.cpp:191:1: error: 'is' does not name a type
191 | is false.
| ^~
p1454.cpp:193:50: error: non-member function 'const char* toupper(char*, const char*)' cannot have cv-qualifier
193 | const char* toupper(char* low, const char* high) const;
| ^~~~~
p1454.cpp:195:50: error: non-member function 'const char* tolower(char*, const char*)' cannot have cv-qualifier
195 | const char* tolower(char* low, const char* high) const;
| ^~~~~
p1454.cpp:197:64: error: non-member function 'const char* widen(const char*, const char*, char*)' cannot have cv-qualifier
197 | const char* widen(const char* low, const char* high, char* to) const;
| ^~~~~
p1454.cpp:199:78: error: non-member function 'const char* narrow(const char*, const char*, char, char*)' cannot have cv-qualifier
199 | const char* narrow(const char* low, const char* high, char dfault, char* to) const;
| ^~~~~
p1454.cpp:203:14: error: 'mask' does not name a type; did you mean 'fd_mask'?
203 | static const mask* classic_table() noexcept;
| ^~~~
| fd_mask
p1454.cpp:206:32: error: non-member function 'char do_toupper(char)' cannot have cv-qualifier
206 | char do_toupper(char) const;
| ^~~~~
p1454.cpp:207:55: error: non-member function 'const char* do_toupper(char*, const char*)' cannot have cv-qualifier
207 | const char* do_toupper(char* low, const char* high) const;
| ^~~~~
p1454.cpp:208:32: error: non-member function 'char do_tolower(char)' cannot have cv-qualifier
208 | char do_tolower(char) const;
| ^~~~~
p1454.cpp:209:55: error: non-member function 'const char* do_tolower(char*, const char*)' cannot have cv-qualifier
209 | const char* do_tolower(char* low, const char* high) const;
| ^~~~~
p1454.cpp:210:3: error: 'virtual' outside class declaration
210 | virtual char do_widen(char c) const;
| ^~~~~~~
p1454.cpp:210:40: error: non-member function 'char do_widen(char)' cannot have cv-qualifier
210 | virtual char do_widen(char c) const;
| ^~~~~
p1454.cpp:211:3: error: 'virtual' outside class declaration
211 | virtual const char* do_widen(const char* low, const char* high, char* to) const;
| ^~~~~~~
p1454.cpp:211:77: error: non-member function 'const char* do_widen(const char*, const char*, char*)' cannot have cv-qualifier
211 | virtual const char* do_widen(const char* low, const char* high, char* to) const;
| ^~~~~
p1454.cpp:212:3: error: 'virtual' outside class declaration
212 | virtual char do_narrow(char c, char dfault) const;
| ^~~~~~~
p1454.cpp:212:54: error: non-member function 'char do_narrow(char, char)' cannot have cv-qualifier
212 | virtual char do_narrow(char c, char dfault) const;
| ^~~~~
p1454.cpp:213:3: error: 'virtual' outside class declaration
213 | virtual const char* do_narrow(const char* low, const char* high,
| ^~~~~~~
p1454.cpp:214:56: error: non-member function 'const char* do_narrow(const char*, const char*, char, char*)' cannot have cv-qualifier
214 | char dfault, char* to) const;
| ^~~~~
p1454.cpp:226:15: error: expected nested-name-specifier before 'intern_type'
226 | using intern_type = internT;
| ^~~~~~~~~~~
p1454.cpp:227:15: error: expected nested-name-specifier before 'extern_type'
227 | using extern_type = externT;
| ^~~~~~~~~~~
p1454.cpp:228:15: error: expected nested-name-specifier before 'state_type'
228 | using state_type = stateT;
| ^~~~~~~~~~
p1454.cpp:238:1: error: declaration of 'externT* externT' shadows template parameter
237 | externT*
| ~~~~~~~~
238 | externT*
| ^~~~~~~
p1454.cpp:223:29: note: template parameter 'externT' declared here
223 | template<class internT, class externT, class stateT>
| ^~~~~
p1454.cpp:238:8: error: expected ',' or '...' before '*' token
238 | externT*
| ^
p1454.cpp:241:10: error: 'const' and 'volatile' function specifiers on 'unshift' invalid in parameter declaration
241 | to_next) const;
| ^~~~~
p1454.cpp:241:15: error: expected ')' before ';' token
241 | to_next) const;
| ^
| )
p1454.cpp:230:11: note: to match this '('
230 | result out(
| ^
p1454.cpp:242:1: error: 'to_next' does not name a type
242 | to_next) const;
| ^~~~~~~
p1454.cpp:247:18: error: expected ';' at end of member declaration
247 | int encoding() const noexcept;
| ^~~~~
| ;
p1454.cpp:247:24: error: 'noexcept' does not name a type
247 | int encoding() const noexcept;
| ^~~~~~~~
p1454.cpp:247:24: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1454.cpp:248:24: error: expected ';' at end of member declaration
248 | bool always_noconv() const noexcept;
| ^~~~~
| ;
p1454.cpp:248:30: error: 'noexcept' does not name a type
248 | bool always_noconv() const noexcept;
| ^~~~~~~~
p1454.cpp:248:30: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1454.cpp:250:20: error: expected ';' at end of member declaration
250 | int max_length() const noexcept;
| ^~~~~
| ;
p1454.cpp:250:26: error: 'noexcept' does not name a type
250 | int max_length() const noexcept;
| ^~~~~~~~
p1454.cpp:250:26: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1454.cpp:262:1: error: expected ',' or '...' before 'virtual'
262 | virtual result do_unshift(
| ^~~~~~~
p1454.cpp:265:15: error: expected ')' before ';' token
265 | to_next) const;
| ^
| )
p1454.cpp:258:23: note: to match this '('
258 | virtual result do_in(
| ^
p1454.cpp:266:1: error: 'to_next' does not name a type
266 | to_next) const;
| ^~~~~~~
p1454.cpp:267:27: error: expected ';' at end of member declaration
267 | virtual int do_encoding() const noexcept;
| ^~~~~
| ;
p1454.cpp:267:33: error: 'noexcept' does not name a type
267 | virtual int do_encoding() const noexcept;
| ^~~~~~~~
p1454.cpp:267:33: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1454.cpp:268:33: error: expected ';' at end of member declaration
268 | virtual bool do_always_noconv() const noexcept;
| ^~~~~
| ;
p1454.cpp:268:39: error: 'noexcept' does not name a type
268 | virtual bool do_always_noconv() const noexcept;
| ^~~~~~~~
p1454.cpp:268:39: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1454.cpp:271:31: error: expected ';' at end of member declaration
271 | virtual int do_max_length() const noexcept;
| ^~~~~
| ;
p1454.cpp:271:37: error: 'noexcept' does not name a type
271 | virtual int do_max_length() const noexcept;
| ^~~~~~~~
p1454.cpp:271:37: note: C++11 'noexcept' only available with '-std=c++11' or '-std=gnu++11'
p1454.cpp:277:1: error: 'result' does not name a type
277 | result out(
| ^~~~~~
p1454.cpp:284:1: error: 'result' does not name a type
284 | result in(
| ^~~~~~
p1454.cpp:290:28: error: expected initializer before 'noexcept'
290 | bool always_noconv() const noexcept;
| ^~~~~~~~
p1454.cpp:292:12: error: 'stateT' was not declared in this scope; did you mean 'static'?
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~~
| static
p1454.cpp:292:20: error: 'state' was not declared in this scope; did you mean 'static'?
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
| static
p1454.cpp:292:27: error: expected primary-expression before 'const'
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:292:48: error: expected primary-expression before 'const'
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:292:80: error: expected primary-expression before 'max'
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~
p1454.cpp:292:83: error: expression list treated as compound expression in initializer [-fpermissive]
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^
p1454.cpp:296:1: error: 'result' does not name a type
296 | result do_out(
| ^~~~~~
p1454.cpp:300:1: error: 'result' does not name a type
300 | result do_in(
| ^~~~~~
p1454.cpp:313:1: error: 'result' does not name a type
313 | result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
| ^~~~~~
p1454.cpp:321:35: error: expected initializer before 'noexcept'
321 | int do_encoding() const noexcept;
| ^~~~~~~~
p1454.cpp:323:31: error: expected initializer before 'noexcept'
323 | bool do_always_noconv() const noexcept;
| ^~~~~~~~
p1454.cpp:325:15: error: 'stateT' was not declared in this scope; did you mean 'static'?
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~~
| static
p1454.cpp:325:23: error: 'state' was not declared in this scope; did you mean 'static'?
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
| static
p1454.cpp:325:30: error: expected primary-expression before 'const'
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:325:51: error: expected primary-expression before 'const'
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:325:83: error: expected primary-expression before 'max'
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~
p1454.cpp:325:86: error: expression list treated as compound expression in initializer [-fpermissive]
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^
p1454.cpp:329:27: error: expected initializer before 'noexcept'
329 | int do_max_length() const noexcept;
| ^~~~~~~~
p1454.cpp:349:77: error: spurious '>>', use '>' to terminate a template argument list
349 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~
p1454.cpp:350:16: error: class template 'num_get' redeclared as non-template
350 | class num_get : public locale::facet {
| ^~~~~~~
In file included from /usr/local/include/c++/12.1.0/ios:41:
/usr/local/include/c++/12.1.0/bits/localefwd.h:157:11: note: previous declaration here
157 | class num_get;
| ^~~~~~~
p1454.cpp:349:52: error: two or more data types in declaration of 'type name'
349 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:424:2: error: expected '>' before ';' token
424 | }; }
| ^
p1454.cpp:424:2: error: expected unqualified-id before ';' token
p1454.cpp:427:1: error: 'iter_type' does not name a type
427 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:429:1: error: 'iter_type' does not name a type
429 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:431:1: error: 'iter_type' does not name a type
431 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:433:1: error: 'iter_type' does not name a type
433 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:435:1: error: 'iter_type' does not name a type
435 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:437:1: error: 'iter_type' does not name a type
437 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:439:1: error: 'iter_type' does not name a type
439 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:441:1: error: 'iter_type' does not name a type
441 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:443:1: error: 'iter_type' does not name a type
443 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:445:1: error: 'iter_type' does not name a type
445 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:447:1: error: 'iter_type' does not name a type
447 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:450:20: error: 'err' declared as reference but not initialized
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:450:25: error: expected unqualified-id before 'void'
450 | ios_base::iostate& err, void*& val) const;
| ^~~~
p1454.cpp:458:1: error: 'fmtflags' does not name a type
458 | fmtflags flags = str.flags();
| ^~~~~~~~
p1454.cpp:459:1: error: 'fmtflags' does not name a type
459 | fmtflags basefield = (flags & ios_base::basefield); fmtflags uppercase = (flags & ios_base::uppercase); fmtflags boolalpha = (flags & ios_base::boolalpha);
| ^~~~~~~~
p1454.cpp:459:53: error: 'fmtflags' does not name a type
459 | fmtflags basefield = (flags & ios_base::basefield); fmtflags uppercase = (flags & ios_base::uppercase); fmtflags boolalpha = (flags & ios_base::boolalpha);
| ^~~~~~~~
p1454.cpp:459:105: error: 'fmtflags' does not name a type
459 | d = (flags & ios_base::basefield); fmtflags uppercase = (flags & ios_base::uppercase); fmtflags boolalpha = (flags & ios_base::boolalpha);
| ^~~~~~~~
p1454.cpp:467:8: error: 'char_type' does not name a type
467 | char_type ct = *in;
| ^~~~~~~~~
p1454.cpp:468:17: error: 'src' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~
p1454.cpp:468:26: error: 'atoms' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~~~
p1454.cpp:468:33: error: 'atoms' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~~~
p1454.cpp:468:48: error: 'src' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~
p1454.cpp:468:58: error: 'ct' was not declared in this scope; did you mean 'c'?
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~
| c
p1454.cpp:468:64: error: 'atoms' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~~~
p1454.cpp:469:8: error: expected unqualified-id before 'if'
469 | if (ct == use_facet<numpunct<charT>>(loc).decimal_point())
| ^~
p1454.cpp:472:10: error: 'ct' was not declared in this scope; did you mean 'c'?
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~
| c
p1454.cpp:472:35: error: 'charT' was not declared in this scope; did you mean 'char'?
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~~~~
| char
p1454.cpp:472:40: warning: '>>' operator is treated as two right angle brackets in C++11 [-Wc++11-compat]
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~
p1454.cpp:472:40: note: suggest parentheses around '>>' expression
p1454.cpp:472:43: error: 'loc' was not declared in this scope; did you mean 'log'?
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~~
| log
p1454.cpp:472:48: error: '.' cannot appear in a constant-expression
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~~~~~~~~~~~~
p1454.cpp:472:62: error: a function call cannot appear in a constant-expression
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^
p1454.cpp:473:32: error: 'charT' was not declared in this scope; did you mean 'char'?
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~~~
| char
p1454.cpp:473:37: warning: '>>' operator is treated as two right angle brackets in C++11 [-Wc++11-compat]
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~
p1454.cpp:473:37: note: suggest parentheses around '>>' expression
p1454.cpp:473:40: error: 'loc' was not declared in this scope; did you mean 'log'?
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~
| log
p1454.cpp:473:45: error: '.' cannot appear in a constant-expression
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~~~~~~
p1454.cpp:473:54: error: a function call cannot appear in a constant-expression
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^
p1454.cpp:473:56: error: '.' cannot appear in a constant-expression
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~~~~
p1454.cpp:473:63: error: a function call cannot appear in a constant-expression
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^
p1454.cpp:473:68: error: template argument 1 is invalid
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^
p1454.cpp:473:13: error: parse error in template argument list
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:473:13: error: 'use_facet<<expression error> >' cannot appear in a constant-expression
p1454.cpp:473:13: error: template argument 1 is invalid
p1454.cpp:472:16: error: parse error in template argument list
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:476:8: error: 'char_type' does not name a type
476 | char_type atoms[sizeof(src)];
| ^~~~~~~~~
p1454.cpp:477:24: error: 'charT' was not declared in this scope; did you mean 'char'?
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~~~
| char
p1454.cpp:477:29: warning: '>>' operator is treated as two right angle brackets in C++11 [-Wc++11-compat]
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~
p1454.cpp:477:29: note: suggest parentheses around '>>' expression
p1454.cpp:477:32: error: 'loc' was not declared in this scope; did you mean 'log'?
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~
| log
p1454.cpp:477:37: error: '.' cannot appear in a constant-expression
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~~~
p1454.cpp:477:43: error: 'src' cannot appear in a constant-expression
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~
p1454.cpp:477:48: error: 'src' cannot appear in a constant-expression
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~
p1454.cpp:477:67: error: 'atoms' was not declared in this scope
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~~~
p1454.cpp:477:72: error: a function call cannot appear in a constant-expression
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^
p1454.cpp:477:72: error: template argument 1 is invalid
p1454.cpp:477:8: error: parse error in template argument list
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:477:8: error: 'use_facet<<expression error> >' does not name a type
p1454.cpp:498:37: error: redefinition of 'std::ios_base::iostate& err'
498 | ios_base::iostate& err, bool& val) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:498:42: error: expected unqualified-id before 'bool'
498 | ios_base::iostate& err, bool& val) const;
| ^~~~
p1454.cpp:508:78: error: spurious '>>', use '>' to terminate a template argument list
508 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~
p1454.cpp:509:16: error: class template 'num_put' redeclared as non-template
509 | class num_put : public locale::facet {
| ^~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:159:11: note: previous declaration here
159 | class num_put;
| ^~~~~~~
p1454.cpp:508:53: error: two or more data types in declaration of 'type name'
508 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:529:2: error: expected '>' before ';' token
529 | }; }
| ^
p1454.cpp:529:2: error: expected unqualified-id before ';' token
p1454.cpp:532:4: error: 'iter_type' does not name a type
532 | iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
| ^~~~~~~~~
p1454.cpp:533:4: error: 'iter_type' does not name a type
533 | iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
| ^~~~~~~~~
p1454.cpp:534:4: error: 'iter_type' does not name a type
534 | iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
| ^~~~~~~~~
p1454.cpp:535:4: error: 'iter_type' does not name a type
535 | iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
| ^~~~~~~~~
p1454.cpp:536:4: error: 'iter_type' does not name a type
536 | iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
| ^~~~~~~~~
p1454.cpp:537:4: error: 'iter_type' does not name a type
537 | iter_type put(iter_type out, ios_base& str, char_type fill, double val) const;
| ^~~~~~~~~
p1454.cpp:538:4: error: 'iter_type' does not name a type
538 | iter_type put(iter_type out, ios_base& str, char_type fill, long double val) const;
| ^~~~~~~~~
p1454.cpp:539:4: error: 'iter_type' does not name a type
539 | iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
| ^~~~~~~~~
p1454.cpp:541:1: error: 'iter_type' does not name a type
541 | iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
| ^~~~~~~~~
p1454.cpp:542:1: error: 'iter_type' does not name a type
542 | iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
| ^~~~~~~~~
p1454.cpp:543:1: error: 'iter_type' does not name a type
543 | iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
| ^~~~~~~~~
p1454.cpp:544:1: error: 'iter_type' does not name a type
544 | iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
| ^~~~~~~~~
p1454.cpp:545:1: error: 'iter_type' does not name a type
545 | iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const;
| ^~~~~~~~~
p1454.cpp:546:1: error: 'iter_type' does not name a type
546 | iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
| ^~~~~~~~~
p1454.cpp:547:1: error: 'iter_type' does not name a type
547 | iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
| ^~~~~~~~~
p1454.cpp:549:16: error: 'str' was not declared in this scope; did you mean 'std'?
549 | locale loc = str.getloc();
| ^~~
| std
p1454.cpp:556:8: error: 'fmtflags' does not name a type
556 | fmtflags flags = str.flags();
| ^~~~~~~~
p1454.cpp:557:8: error: 'fmtflags' does not name a type
557 | fmtflags basefield = (flags & (ios_base::basefield));
| ^~~~~~~~
p1454.cpp:558:8: error: 'fmtflags' does not name a type
558 | fmtflags uppercase = (flags & (ios_base::uppercase));
| ^~~~~~~~
p1454.cpp:559:8: error: 'fmtflags' does not name a type
559 | fmtflags floatfield = (flags & (ios_base::floatfield));
| ^~~~~~~~
p1454.cpp:560:8: error: 'fmtflags' does not name a type
560 | fmtflags showpos = (flags & (ios_base::showpos));
| ^~~~~~~~
p1454.cpp:561:8: error: 'fmtflags' does not name a type
561 | fmtflags showbase = (flags & (ios_base::showbase));
| ^~~~~~~~
p1454.cpp:562:8: error: 'fmtflags' does not name a type
562 | fmtflags showpoint = (flags & (ios_base::showpoint));
| ^~~~~~~~
p1454.cpp:576:16: error: 'charT' was not declared in this scope; did you mean 'char'?
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~~~~
| char
p1454.cpp:576:21: error: template argument 1 is invalid
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^
p1454.cpp:576:51: error: 'charT' was not declared in this scope; did you mean 'char'?
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~~~~
| char
p1454.cpp:576:56: warning: '>>' operator is treated as two right angle brackets in C++11 [-Wc++11-compat]
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~
p1454.cpp:576:56: note: suggest parentheses around '>>' expression
p1454.cpp:576:59: error: 'loc' cannot appear in a constant-expression
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~~
p1454.cpp:576:62: error: template argument 1 is invalid
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^
p1454.cpp:576:32: error: parse error in template argument list
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:576:32: error: invalid initialization of reference of type 'const int&' from expression of type <unresolved overloaded function type>'
p1454.cpp:579:1: error: 'fmtflags' does not name a type
579 | fmtflags adjustfield = (flags & (ios_base::adjustfield));
| ^~~~~~~~
p1454.cpp:587:4: error: 'iter_type' does not name a type
587 | iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;
| ^~~~~~~~~
p1454.cpp:589:3: error: 'string_type' does not name a type
589 | string_type s =
| ^~~~~~~~~~~
p1454.cpp:600:15: error: expected nested-name-specifier before 'char_type'
600 | using char_type = charT;
| ^~~~~~~~~
p1454.cpp:601:15: error: expected nested-name-specifier before 'string_type'
601 | using string_type = basic_string<charT>;
| ^~~~~~~~~~~
p1454.cpp:603:40: error: declaration does not declare anything [-fpermissive]
603 | const;
| ^~~~~
p1454.cpp:604:40: error: declaration does not declare anything [-fpermissive]
604 | const;
| ^~~~~
p1454.cpp:605:40: error: declaration does not declare anything [-fpermissive]
605 | const;
| ^~~~~
p1454.cpp:606:40: error: declaration does not declare anything [-fpermissive]
606 | const;
| ^~~~~
p1454.cpp:607:40: error: declaration does not declare anything [-fpermissive]
607 | const;
| ^~~~~
p1454.cpp:608:1: error: 'char_type' does not name a type
608 | char_type
| ^~~~~~~~~
p1454.cpp:614:33: error: 'char_type' does not name a type
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~~~
p1454.cpp:616:25: error: expected constructor, destructor, or type conversion before ';' token
616 | do_decimal_point() const;
| ^
p1454.cpp:617:25: error: expected constructor, destructor, or type conversion before ';' token
617 | do_thousands_sep() const;
| ^
p1454.cpp:621:1: error: expected constructor, destructor, or type conversion before 'thousands_sep'
621 | thousands_sep()
| ^~~~~~~~~~~~~
p1454.cpp:627:1: error: declaration does not declare anything [-fpermissive]
627 | const;
| ^~~~~
p1454.cpp:628:1: error: declaration does not declare anything [-fpermissive]
628 | const;
| ^~~~~
p1454.cpp:638:1: error: 'char_type' does not name a type
638 | char_type do_decimal_point() const;
| ^~~~~~~~~
p1454.cpp:643:1: error: 'char_type' does not name a type
643 | char_type decimal_point() const;
| ^~~~~~~~~
p1454.cpp:647:1: error: 'string_type' does not name a type
647 | string_type falsename() const;
| ^~~~~~~~~~~
p1454.cpp:648:1: error: expected unqualified-id before '[' token
648 | [facet.numpunct.members]
| ^
p1454.cpp:652:22: error: non-member function 'std::string do_grouping()' cannot have cv-qualifier
652 | string do_grouping() const;
| ^~~~~
p1454.cpp:655:1: error: 'string_type' does not name a type
655 | string_type do_truename() const;
| ^~~~~~~~~~~
p1454.cpp:656:1: error: 'string_type' does not name a type
656 | string_type do_falsename() const;
| ^~~~~~~~~~~
p1454.cpp:662:32: error: reference to 'numpunct' is ambiguous
662 | class numpunct_byname : public numpunct<charT> { // this class is specialized for char and wchar_t. public:
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:162:35: note: candidates are: 'template<class _CharT> class std::__cxx11::numpunct'
162 | template<typename _CharT> class numpunct;
| ^~~~~~~~
p1454.cpp:598:13: note: 'template<class charT> class std::numpunct'
598 | class numpunct : public locale::facet {
| ^~~~~~~~
p1454.cpp:662:40: error: expected template-name before '<' token
662 | class numpunct_byname : public numpunct<charT> { // this class is specialized for char and wchar_t. public:
| ^
p1454.cpp:662:40: error: expected '{' before '<' token
p1454.cpp:678:15: error: expected nested-name-specifier before 'char_type'
678 | using char_type = charT;
| ^~~~~~~~~
p1454.cpp:679:15: error: expected nested-name-specifier before 'string_type'
679 | using string_type = basic_string<charT>;
| ^~~~~~~~~~~
p1454.cpp:683:9: error: 'string_type' does not name a type
683 | string_type transform(const charT* low, const charT* high) const;
| ^~~~~~~~~~~
p1454.cpp:691:20: error: 'string_type' does not name a type
691 | virtual string_type do_transform(const charT* low, const charT* high) const;
| ^~~~~~~~~~~
p1454.cpp:698:22: error: 'charT' does not name a type; did you mean 'char'?
698 | int compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:698:41: error: 'charT' does not name a type; did you mean 'char'?
698 | int compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:699:22: error: 'charT' does not name a type; did you mean 'char'?
699 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:699:41: error: 'charT' does not name a type; did you mean 'char'?
699 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:699:55: error: non-member function 'int compare(const int*, const int*, const int*, const int*)' cannot have cv-qualifier
699 | const charT* low2, const charT* high2) const;
| ^~~~~
p1454.cpp:702:17: error: 'charT' does not name a type; did you mean 'char'?
702 | long hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:702:35: error: 'charT' does not name a type; did you mean 'char'?
702 | long hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:702:48: error: non-member function 'long int hash(const int*, const int*)' cannot have cv-qualifier
702 | long hash(const charT* low, const charT* high) const;
| ^~~~~
p1454.cpp:705:22: error: 'charT' does not name a type; did you mean 'char'?
705 | int do_compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:705:41: error: 'charT' does not name a type; did you mean 'char'?
705 | int do_compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:706:7: error: 'charT' does not name a type; did you mean 'char'?
706 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:706:26: error: 'charT' does not name a type; did you mean 'char'?
706 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:706:40: error: non-member function 'int do_compare(const int*, const int*, const int*, const int*)' cannot have cv-qualifier
706 | const charT* low2, const charT* high2) const;
| ^~~~~
p1454.cpp:708:4: error: 'string_type' does not name a type
708 | string_type do_transform(const charT* low, const charT* high) const;
| ^~~~~~~~~~~
p1454.cpp:710:20: error: 'charT' does not name a type; did you mean 'char'?
710 | long do_hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:710:38: error: 'charT' does not name a type; did you mean 'char'?
710 | long do_hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:710:51: error: non-member function 'long int do_hash(const int*, const int*)' cannot have cv-qualifier
710 | long do_hash(const charT* low, const charT* high) const;
| ^~~~~
p1454.cpp:712:1: error: 'Recommended' does not name a type
712 | Recommended practice: The probability that the result equals that for another string which does not compare equal should be very small, approaching (1.0/numeric_limits<unsigned long>::max()).
| ^~~~~~~~~~~
p1454.cpp:733:74: error: spurious '>>', use '>' to terminate a template argument list
733 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~
p1454.cpp:734:63: error: definition of 'class std::time_get' inside template parameter list
734 | class time_get : public locale::facet, public time_base {
| ^
p1454.cpp:733:49: error: two or more data types in declaration of 'type name'
733 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:774:2: error: expected '>' before ';' token
774 | }; }
| ^
p1454.cpp:774:2: error: expected unqualified-id before ';' token
p1454.cpp:778:1: error: 'dateorder' does not name a type
778 | dateorder date_order() const;
| ^~~~~~~~~
p1454.cpp:780:1: error: 'iter_type' does not name a type
780 | iter_type get_time(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:782:34: error: redefinition of 'std::ios_base::iostate& err'
782 | ios_base::iostate& err, tm* t) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:782:41: error: expected initializer before '*' token
782 | ios_base::iostate& err, tm* t) const;
| ^
p1454.cpp:784:1: error: 'iter_type' does not name a type
784 | iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:786:1: error: 'iter_type' does not name a type
786 | iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:789:34: error: redefinition of 'std::ios_base::iostate& err'
789 | ios_base::iostate& err, tm* t) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:789:41: error: expected initializer before '*' token
789 | ios_base::iostate& err, tm* t) const;
| ^
p1454.cpp:792:1: error: 'iter_type' does not name a type
792 | iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
| ^~~~~~~~~
p1454.cpp:795:1: error: 'iter_type' does not name a type
795 | iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
| ^~~~~~~~~
p1454.cpp:808:1: error: 'dateorder' does not name a type
808 | dateorder do_date_order() const;
| ^~~~~~~~~
p1454.cpp:810:1: error: 'iter_type' does not name a type
810 | iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:814:1: error: 'iter_type' does not name a type
814 | iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:818:15: error: expected constructor, destructor, or type conversion before 'Format'
818 | date_order() Format
| ^~~~~~
p1454.cpp:825:1: error: 'iter_type' does not name a type
825 | iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:829:37: error: redefinition of 'std::ios_base::iostate& err'
829 | ios_base::iostate& err, tm* t) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:829:44: error: expected initializer before '*' token
829 | ios_base::iostate& err, tm* t) const;
| ^
p1454.cpp:832:1: error: 'iter_type' does not name a type
832 | iter_type do_get(iter_type s, iter_type end, ios_base& f,
| ^~~~~~~~~
p1454.cpp:841:74: error: spurious '>>', use '>' to terminate a template argument list
841 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~
p1454.cpp:842:54: error: 'InputIterator' was not declared in this scope; did you mean 'insert_iterator'?
842 | class time_get_byname : public time_get<charT, InputIterator> {
| ^~~~~~~~~~~~~
| insert_iterator
p1454.cpp:842:67: error: template argument 2 is invalid
842 | class time_get_byname : public time_get<charT, InputIterator> {
| ^
p1454.cpp:842:69: error: definition of 'class std::time_get_byname' inside template parameter list
842 | class time_get_byname : public time_get<charT, InputIterator> {
| ^
p1454.cpp:841:49: error: two or more data types in declaration of 'type name'
841 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:853:2: error: expected '>' before ';' token
853 | }; }
| ^
p1454.cpp:853:2: error: expected unqualified-id before ';' token
p1454.cpp:856:75: error: spurious '>>', use '>' to terminate a template argument list
856 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~
p1454.cpp:857:13: error: class template 'time_put' redeclared as non-template
857 | class time_put : public locale::facet {
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:183:11: note: previous declaration here
183 | class time_put;
| ^~~~~~~~
p1454.cpp:856:50: error: two or more data types in declaration of 'type name'
856 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:873:2: error: expected '>' before ';' token
873 | }; }
| ^
p1454.cpp:873:2: error: expected unqualified-id before ';' token
p1454.cpp:875:1: error: 'iter_type' does not name a type
875 | iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
| ^~~~~~~~~
p1454.cpp:877:1: error: 'iter_type' does not name a type
877 | iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
| ^~~~~~~~~
p1454.cpp:881:1: error: 'iter_type' does not name a type
881 | iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
| ^~~~~~~~~
p1454.cpp:890:75: error: spurious '>>', use '>' to terminate a template argument list
890 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~
p1454.cpp:891:13: error: class template 'time_put_byname' redeclared as non-template
891 | class time_put_byname : public time_put<charT, OutputIterator> {
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:185:11: note: previous declaration here
185 | class time_put_byname;
| ^~~~~~~~~~~~~~~
p1454.cpp:891:54: error: 'OutputIterator' was not declared in this scope; did you mean 'output_iterator_ta'?
891 | class time_put_byname : public time_put<charT, OutputIterator> {
| ^~~~~~~~~~~~~~
| output_iterator_tag
p1454.cpp:891:68: error: template argument 2 is invalid
891 | class time_put_byname : public time_put<charT, OutputIterator> {
| ^
p1454.cpp:890:50: error: two or more data types in declaration of 'type name'
890 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:898:2: error: expected '>' before ';' token
898 | }; }
| ^
p1454.cpp:898:2: error: expected unqualified-id before ';' token
p1454.cpp:905:77: error: spurious '>>', use '>' to terminate a template argument list
905 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~
p1454.cpp:906:49: error: definition of 'class std::money_get' inside template parameter list
906 | class money_get : public locale::facet {
| ^
p1454.cpp:905:52: error: two or more data types in declaration of 'type name'
905 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:919:2: error: expected '>' before ';' token
919 | }; }
| ^
p1454.cpp:919:2: error: expected unqualified-id before ';' token
p1454.cpp:921:1: error: 'iter_type' does not name a type
921 | iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
| ^~~~~~~~~
p1454.cpp:923:1: error: 'iter_type' does not name a type
923 | iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
| ^~~~~~~~~
p1454.cpp:927:1: error: 'iter_type' does not name a type
927 | iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:929:1: error: 'iter_type' does not name a type
929 | iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:939:1: error: expected unqualified-id before 'protected'
939 | protected:
| ^~~~~~~~~
p1454.cpp:941:9: error: 'iter_type' does not name a type
941 | virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
| ^~~~~~~~~
p1454.cpp:943:11: error: 'iter_type' does not name a type
943 | virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
| ^~~~~~~~~
p1454.cpp:946:3: error: expected unqualified-id before 'for'
946 | for (int i = 0; i < n; ++i)
| ^~~
p1454.cpp:946:19: error: 'i' does not name a type
946 | for (int i = 0; i < n; ++i)
| ^
p1454.cpp:946:26: error: expected unqualified-id before '++' token
946 | for (int i = 0; i < n; ++i)
| ^~
p1454.cpp:948:3: error: 'buf2' does not name a type
948 | buf2[n] = 0;
| ^~~~
p1454.cpp:949:9: error: expected constructor, destructor, or type conversion before '(' token
949 | sscanf(buf2, "%Lf", &units);
| ^
p1454.cpp:951:21: error: redefinition of 'const char src []'
951 | static const char src[] = "0123456789-";
| ^~~
p1454.cpp:475:19: note: 'const char src [29]' previously defined here
475 | static const char src[] = "0123456789abcdefpxABCDEFPX+-";
| ^~~
p1454.cpp:952:3: error: 'charT' does not name a type; did you mean 'char'?
952 | charT atoms[sizeof(src)];
| ^~~~~
| char
p1454.cpp:953:3: error: 'ct' does not name a type
953 | ct.widen(src, src + sizeof(src) - 1, atoms);
| ^~
p1454.cpp:958:75: error: spurious '>>', use '>' to terminate a template argument list
958 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~
p1454.cpp:959:46: error: definition of 'class std::money_put' inside template parameter list
959 | class money_put : public locale::facet {
| ^
p1454.cpp:958:50: error: two or more data types in declaration of 'type name'
958 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:975:2: error: expected '>' before ';' token
975 | }; }
| ^
p1454.cpp:975:2: error: expected unqualified-id before ';' token
p1454.cpp:977:7: error: 'string_type' does not name a type
977 | const string_type& digits) const;
| ^~~~~~~~~~~
p1454.cpp:978:1: error: 'iter_type' does not name a type
978 | iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
| ^~~~~~~~~
p1454.cpp:979:1: error: 'iter_type' does not name a type
979 | iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
| ^~~~~~~~~
p1454.cpp:981:1: error: 'iter_type' does not name a type
981 | iter_type do_put(iter_type s, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:983:1: error: 'iter_type' does not name a type
983 | iter_type do_put(iter_type s, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:986:8: error: 'ct' does not name a type
986 | ct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2)
| ^~
p1454.cpp:1007:1: error: 'charT' does not name a type; did you mean 'char'?
1007 | charT
| ^~~~~
| char
p1454.cpp:1011:1: error: 'string_type' does not name a type
1011 | string_type positive_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1012:1: error: 'string_type' does not name a type
1012 | string_type negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1013:19: error: non-member function 'int frac_digits()' cannot have cv-qualifier
1013 | int frac_digits() const;
| ^~~~~
p1454.cpp:1014:1: error: 'pattern' does not name a type
1014 | pattern pos_format() const;
| ^~~~~~~
p1454.cpp:1015:1: error: 'pattern' does not name a type
1015 | pattern neg_format() const;
| ^~~~~~~
p1454.cpp:1016:22: error: expected constructor, destructor, or type conversion before ';' token
1016 | decimal_point() const;
| ^
p1454.cpp:1017:22: error: expected constructor, destructor, or type conversion before ';' token
1017 | thousands_sep() const;
| ^
p1454.cpp:1018:22: error: expected constructor, destructor, or type conversion before ';' token
1018 | grouping() const;
| ^
p1454.cpp:1019:19: error: redefinition of 'std::locale::id id'
1019 | static locale::id id;
| ^~
p1454.cpp:938:21: note: 'std::locale::id id' previously declared here
938 | static locale::id id;
| ^~
p1454.cpp:1020:26: error: 'International' was not declared in this scope
1020 | static const bool intl = International;
| ^~~~~~~~~~~~~
p1454.cpp:1021:1: error: expected unqualified-id before 'protected'
1021 | protected:
| ^~~~~~~~~
p1454.cpp:1023:9: error: 'charT' does not name a type; did you mean 'char'?
1023 | virtual charT
| ^~~~~
| char
p1454.cpp:1026:53: error: 'string_type' does not name a type
1026 | virtual string_type do_curr_symbol() const; virtual string_type do_positive_sign() const; virtual string_type do_negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1026:99: error: 'string_type' does not name a type
1026 | ing_type do_curr_symbol() const; virtual string_type do_positive_sign() const; virtual string_type do_negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1027:1: error: 'virtual' outside class declaration
1027 | virtual int do_frac_digits() const;
| ^~~~~~~
p1454.cpp:1027:30: error: non-member function 'int do_frac_digits()' cannot have cv-qualifier
1027 | virtual int do_frac_digits() const;
| ^~~~~
p1454.cpp:1028:9: error: 'pattern' does not name a type
1028 | virtual pattern do_pos_format() const;
| ^~~~~~~
p1454.cpp:1029:9: error: 'pattern' does not name a type
1029 | virtual pattern do_neg_format() const;
| ^~~~~~~
p1454.cpp:1030:25: error: expected constructor, destructor, or type conversion before ';' token
1030 | do_decimal_point() const;
| ^
p1454.cpp:1031:25: error: expected constructor, destructor, or type conversion before ';' token
1031 | do_thousands_sep() const;
| ^
p1454.cpp:1032:25: error: expected constructor, destructor, or type conversion before ';' token
1032 | do_grouping() const;
| ^
p1454.cpp:1041:1: error: 'charT' does not name a type; did you mean 'char'?
1041 | charT do_decimal_point() const;
| ^~~~~
| char
p1454.cpp:1044:1: error: 'defined' does not name a type
1044 | defined identically as the member numpunct<>::do_grouping().
| ^~~~~~~
p1454.cpp:1050:1: error: 'string_type' does not name a type
1050 | string_type positive_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1051:1: error: 'string_type' does not name a type
1051 | string_type negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1052:19: error: non-member function 'int frac_digits()' cannot have cv-qualifier
1052 | int frac_digits() const;
| ^~~~~
p1454.cpp:1053:1: error: 'pattern' does not name a type
1053 | pattern pos_format() const;
| ^~~~~~~
p1454.cpp:1054:1: error: 'pattern' does not name a type
1054 | pattern neg_format() const;
| ^~~~~~~
p1454.cpp:1055:22: error: expected constructor, destructor, or type conversion before ';' token
1055 | decimal_point() const;
| ^
p1454.cpp:1056:22: error: expected constructor, destructor, or type conversion before ';' token
1056 | thousands_sep() const;
| ^
p1454.cpp:1057:22: error: expected constructor, destructor, or type conversion before ';' token
1057 | grouping() const;
| ^
p1454.cpp:1058:1: error: 'charT' does not name a type; did you mean 'char'?
1058 | charT do_thousands_sep() const;
| ^~~~~
| char
p1454.cpp:1061:1: error: 'string_type' does not name a type
1061 | string_type do_curr_symbol() const;
| ^~~~~~~~~~~
p1454.cpp:1064:1: error: 'string_type' does not name a type
1064 | string_type do_positive_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1065:1: error: 'string_type' does not name a type
1065 | string_type do_negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1067:22: error: non-member function 'int do_frac_digits()' cannot have cv-qualifier
1067 | int do_frac_digits() const;
| ^~~~~
p1454.cpp:1069:1: error: 'pattern' does not name a type
1069 | pattern do_neg_format() const;
| ^~~~~~~
p1454.cpp:1074:1: error: expected unqualified-id before 'return'
1074 | return an object of type pattern initialized to { symbol, sign, none, value }.270
| ^~~~~~
p1454.cpp:1074:78: error: expected unqualified-id before numeric constant
1074 | return an object of type pattern initialized to { symbol, sign, none, value }.270
| ^~~~
p1454.cpp:1099:7: error: expected nested-name-specifier before 'catalog'
1099 | using catalog = unspecified signed integer type; };
| ^~~~~~~
p1454.cpp:1103:15: error: expected nested-name-specifier before 'char_type'
1103 | using char_type = charT;
| ^~~~~~~~~
p1454.cpp:1104:15: error: expected nested-name-specifier before 'string_type'
1104 | using string_type = basic_string<charT>;
| ^~~~~~~~~~~
p1454.cpp:1106:9: error: 'catalog' does not name a type
1106 | catalog open(const string& fn, const locale&) const;
| ^~~~~~~
p1454.cpp:1107:9: error: 'string_type' does not name a type
1107 | string_type get(catalog c, int set, int msgid,
| ^~~~~~~~~~~
p1454.cpp:1109:20: error: 'catalog' has not been declared
1109 | void close(catalog c) const;
| ^~~~~~~
p1454.cpp:1113:9: error: 'catalog' does not name a type
1113 | virtual catalog do_open(const string&, const locale&) const;
| ^~~~~~~
p1454.cpp:1114:9: error: 'string_type' does not name a type
1114 | virtual string_type do_get(catalog, int set, int msgid,
| ^~~~~~~~~~~
p1454.cpp:1116:31: error: 'catalog' has not been declared
1116 | virtual void do_close(catalog) const;
| ^~~~~~~
p1454.cpp:1121:4: error: 'catalog' does not name a type
1121 | catalog open(const string& name, const locale& loc) const;
| ^~~~~~~
p1454.cpp:1123:1: error: 'string_type' does not name a type
1123 | string_type get(catalog cat, int set, int msgid, const string_type& dfault) const;
| ^~~~~~~~~~~
p1454.cpp:1127:1: error: 'catalog' does not name a type
1127 | catalog do_open(const string& name, const locale& loc) const;
| ^~~~~~~
p1454.cpp:1131:1: error: 'string_type' does not name a type
1131 | string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const;
| ^~~~~~~~~~~
p1454.cpp:1134:9: error: variable or field 'do_close' declared void
1134 | void do_close(catalog cat) const;
| ^~~~~~~~
p1454.cpp:1134:18: error: 'catalog' was not declared in this scope
1134 | void do_close(catalog cat) const;
| ^~~~~~~
p1454.cpp:1140:38: error: reference to 'messages' is ambiguous
1140 | class messages_byname : public messages<charT> {
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:206:11: note: candidates are: 'template<class _CharT> class std::__cxx11::messages'
206 | class messages;
| ^~~~~~~~
p1454.cpp:1101:13: note: 'template<class charT> class std::messages'
1101 | class messages : public locale::facet, public messages_base {
| ^~~~~~~~
p1454.cpp:1140:46: error: expected template-name before '<' token
1140 | class messages_byname : public messages<charT> {
| ^
p1454.cpp:1140:46: error: expected '{' before '<' token
$ g++ p1454.cpp -std=2b -o p1454g -I. -Wall
p1454.cpp:22:14: error: redefinition of 'class std::ctype_base'
22 | class ctype_base {
| ^~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/bits/locale_facets.h:41,
from /usr/local/include/c++/12.1.0/bits/basic_ios.h:37,
from /usr/local/include/c++/12.1.0/ios:44,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from N4910.h:2,
from p1454.cpp:10:
/usr/local/include/c++/12.1.0/x86_64-linux-gnu/bits/ctype_base.h:41:10: note: previous definition of 'class std::ctype_base'
41 | struct ctype_base
| ^~~~~~~~~~
p1454.cpp:44:16: error: redefinition of 'class std::ctype<_CharT>'
44 | class ctype : public locale::facet, public ctype_base {
| ^~~~~
/usr/local/include/c++/12.1.0/bits/locale_facets.h:615:11: note: previous definition of 'class std::ctype<_CharT>'
615 | class ctype : public __ctype_abstract_base<_CharT>
| ^~~~~
p1454.cpp:79:9: error: 'mask' was not declared in this scope
79 | bool is(mask m, charT c) const;
| ^~~~
p1454.cpp:79:17: error: 'charT' was not declared in this scope; did you mean 'char'?
79 | bool is(mask m, charT c) const;
| ^~~~~
| char
p1454.cpp:79:24: error: expression list treated as compound expression in initializer [-fpermissive]
79 | bool is(mask m, charT c) const;
| ^
p1454.cpp:80:7: error: 'charT' does not name a type; did you mean 'char'?
80 | const charT* is(const charT* low, const charT* high, mask* vec) const;
| ^~~~~
| char
p1454.cpp:82:7: error: 'charT' does not name a type; did you mean 'char'?
82 | const charT* scan_is(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:84:7: error: 'charT' does not name a type; did you mean 'char'?
84 | const charT* scan_not(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:86:7: error: 'charT' does not name a type; did you mean 'char'?
86 | const charT* toupper(charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:88:7: error: 'charT' does not name a type; did you mean 'char'?
88 | const charT* tolower(charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:90:54: error: 'charT' has not been declared
90 | const char* widen(const char* low, const char* high, charT* to) const;
| ^~~~~
p1454.cpp:90:65: error: non-member function 'const char* widen(const char*, const char*, int*)' cannot have cv-qualifier
90 | const char* widen(const char* low, const char* high, charT* to) const;
| ^~~~~
p1454.cpp:93:20: error: 'mask' was not declared in this scope
93 | bool do_is(mask m, charT c) const;
| ^~~~
p1454.cpp:93:28: error: 'charT' was not declared in this scope; did you mean 'char'?
93 | bool do_is(mask m, charT c) const;
| ^~~~~
| char
p1454.cpp:93:35: error: expression list treated as compound expression in initializer [-fpermissive]
93 | bool do_is(mask m, charT c) const;
| ^
p1454.cpp:94:7: error: 'charT' does not name a type; did you mean 'char'?
94 | const charT* do_is(const charT* low, const charT* high, mask* vec) const;
| ^~~~~
| char
p1454.cpp:97:7: error: 'charT' does not name a type; did you mean 'char'?
97 | const charT* do_scan_is(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:100:7: error: 'charT' does not name a type; did you mean 'char'?
100 | const charT* do_scan_not(mask m, const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:103:1: error: expected unqualified-id before 'false'
103 | false; otherwise, returns high.
| ^~~~~
p1454.cpp:103:8: error: 'otherwise' does not name a type
103 | false; otherwise, returns high.
| ^~~~~~~~~
p1454.cpp:109:10: error: 'charT' does not name a type; did you mean 'char'?
109 | const charT* do_toupper(charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:112:1: error: 'charT' does not name a type; did you mean 'char'?
112 | charT
| ^~~~~
| char
p1454.cpp:114:11: error: expected constructor, destructor, or type conversion before '(' token
114 | do_tolower(charT c) const;
| ^
p1454.cpp:117:1: error: 'charT' does not name a type; did you mean 'char'?
117 | charT
| ^~~~~
| char
p1454.cpp:119:23: error: expected constructor, destructor, or type conversion before ';' token
119 | do_widen(char c) const;
| ^
p1454.cpp:124:12: error: expected initializer before '*' token
124 | const charT* do_narrow(const charT* low, const charT* high, char dfault, char* dest) const;
| ^
p1454.cpp:128:13: error: redefinition of 'class std::ctype_byname<_CharT>'
128 | class ctype_byname : public ctype<charT> {
| ^~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/locale_facets.h:1486:11: note: previous definition of 'class std::ctype_byname<_CharT>'
1486 | class ctype_byname : public ctype<_CharT>
| ^~~~~~~~~~~~
p1454.cpp:141:13: error: redefinition of 'class std::ctype<char>'
141 | class ctype<char> : public locale::facet, public ctype_base {
| ^~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/locale_facets.h:689:11: note: previous definition of 'class std::ctype<char>'
689 | class ctype<char> : public locale::facet, public ctype_base
| ^~~~~~~~~~~
p1454.cpp:174:7: error: expected class-name before '(' token
174 | ~ctype();
| ^
p1454.cpp:176:1: error: expected unqualified-id before '[' token
176 | [] table().
| ^
p1454.cpp:182:13: error: redefinition of 'bool is'
182 | bool is(mask m, char c) const;
| ^~
p1454.cpp:79:6: note: 'bool is' previously defined here
79 | bool is(mask m, charT c) const;
| ^~
p1454.cpp:182:16: error: 'mask' was not declared in this scope
182 | bool is(mask m, char c) const;
| ^~~~
p1454.cpp:182:24: error: expected primary-expression before 'char'
182 | bool is(mask m, char c) const;
| ^~~~
p1454.cpp:183:51: error: 'mask' has not been declared
183 | const char* is(const char* low, const char* high, mask* vec) const;
| ^~~~
p1454.cpp:183:62: error: non-member function 'const char* is(const char*, const char*, int*)' cannot have cv-qualifier
183 | const char* is(const char* low, const char* high, mask* vec) const;
| ^~~~~
p1454.cpp:183:62: error: 'const char* is(const char*, const char*, int*)' redeclared as different kind of entity
p1454.cpp:79:6: note: previous declaration 'bool is'
79 | bool is(mask m, charT c) const;
| ^~
p1454.cpp:186:21: error: 'mask' was not declared in this scope
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^~~~
p1454.cpp:186:29: error: expected primary-expression before 'const'
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^~~~~
p1454.cpp:186:46: error: expected primary-expression before 'const'
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^~~~~
p1454.cpp:186:62: error: expression list treated as compound expression in initializer [-fpermissive]
186 | const char* scan_is(mask m, const char* low, const char* high) const;
| ^
p1454.cpp:188:1: error: 'is' does not name a type
188 | is true.
| ^~
p1454.cpp:191:1: error: 'is' does not name a type
191 | is false.
| ^~
p1454.cpp:193:50: error: non-member function 'const char* toupper(char*, const char*)' cannot have cv-qualifier
193 | const char* toupper(char* low, const char* high) const;
| ^~~~~
p1454.cpp:195:50: error: non-member function 'const char* tolower(char*, const char*)' cannot have cv-qualifier
195 | const char* tolower(char* low, const char* high) const;
| ^~~~~
p1454.cpp:197:64: error: non-member function 'const char* widen(const char*, const char*, char*)' cannot have cv-qualifier
197 | const char* widen(const char* low, const char* high, char* to) const;
| ^~~~~
p1454.cpp:199:78: error: non-member function 'const char* narrow(const char*, const char*, char, char*)' cannot have cv-qualifier
199 | const char* narrow(const char* low, const char* high, char dfault, char* to) const;
| ^~~~~
p1454.cpp:203:14: error: 'mask' does not name a type; did you mean 'fd_mask'?
203 | static const mask* classic_table() noexcept;
| ^~~~
| fd_mask
p1454.cpp:206:32: error: non-member function 'char do_toupper(char)' cannot have cv-qualifier
206 | char do_toupper(char) const;
| ^~~~~
p1454.cpp:207:55: error: non-member function 'const char* do_toupper(char*, const char*)' cannot have cv-qualifier
207 | const char* do_toupper(char* low, const char* high) const;
| ^~~~~
p1454.cpp:208:32: error: non-member function 'char do_tolower(char)' cannot have cv-qualifier
208 | char do_tolower(char) const;
| ^~~~~
p1454.cpp:209:55: error: non-member function 'const char* do_tolower(char*, const char*)' cannot have cv-qualifier
209 | const char* do_tolower(char* low, const char* high) const;
| ^~~~~
p1454.cpp:210:3: error: 'virtual' outside class declaration
210 | virtual char do_widen(char c) const;
| ^~~~~~~
p1454.cpp:210:40: error: non-member function 'char do_widen(char)' cannot have cv-qualifier
210 | virtual char do_widen(char c) const;
| ^~~~~
p1454.cpp:211:3: error: 'virtual' outside class declaration
211 | virtual const char* do_widen(const char* low, const char* high, char* to) const;
| ^~~~~~~
p1454.cpp:211:77: error: non-member function 'const char* do_widen(const char*, const char*, char*)' cannot have cv-qualifier
211 | virtual const char* do_widen(const char* low, const char* high, char* to) const;
| ^~~~~
p1454.cpp:212:3: error: 'virtual' outside class declaration
212 | virtual char do_narrow(char c, char dfault) const;
| ^~~~~~~
p1454.cpp:212:54: error: non-member function 'char do_narrow(char, char)' cannot have cv-qualifier
212 | virtual char do_narrow(char c, char dfault) const;
| ^~~~~
p1454.cpp:213:3: error: 'virtual' outside class declaration
213 | virtual const char* do_narrow(const char* low, const char* high,
| ^~~~~~~
p1454.cpp:214:56: error: non-member function 'const char* do_narrow(const char*, const char*, char, char*)' cannot have cv-qualifier
214 | char dfault, char* to) const;
| ^~~~~
p1454.cpp:238:1: error: declaration of 'externT* externT' shadows template parameter
237 | externT*
| ~~~~~~~~
238 | externT*
| ^~~~~~~
p1454.cpp:223:29: note: template parameter 'externT' declared here
223 | template<class internT, class externT, class stateT>
| ^~~~~
p1454.cpp:238:8: error: expected ',' or '...' before '*' token
238 | externT*
| ^
p1454.cpp:241:10: error: 'const' and 'volatile' function specifiers on 'unshift' invalid in parameter declaration
241 | to_next) const;
| ^~~~~
p1454.cpp:241:15: error: expected ')' before ';' token
241 | to_next) const;
| ^
| )
p1454.cpp:230:11: note: to match this '('
230 | result out(
| ^
p1454.cpp:242:1: error: 'to_next' does not name a type
242 | to_next) const;
| ^~~~~~~
p1454.cpp:262:1: error: expected ',' or '...' before 'virtual'
262 | virtual result do_unshift(
| ^~~~~~~
p1454.cpp:265:15: error: expected ')' before ';' token
265 | to_next) const;
| ^
| )
p1454.cpp:258:23: note: to match this '('
258 | virtual result do_in(
| ^
p1454.cpp:266:1: error: 'to_next' does not name a type
266 | to_next) const;
| ^~~~~~~
p1454.cpp:277:1: error: 'result' does not name a type
277 | result out(
| ^~~~~~
p1454.cpp:284:1: error: 'result' does not name a type
284 | result in(
| ^~~~~~
p1454.cpp:290:28: error: non-member function 'bool always_noconv()' cannot have cv-qualifier
290 | bool always_noconv() const noexcept;
| ^~~~~~~~
p1454.cpp:292:12: error: 'stateT' was not declared in this scope; did you mean 'static'?
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~~
| static
p1454.cpp:292:20: error: 'state' was not declared in this scope; did you mean 'static'?
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
| static
p1454.cpp:292:27: error: expected primary-expression before 'const'
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:292:48: error: expected primary-expression before 'const'
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:292:80: error: expected primary-expression before 'max'
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~
p1454.cpp:292:83: error: expression list treated as compound expression in initializer [-fpermissive]
292 | int length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^
p1454.cpp:296:1: error: 'result' does not name a type
296 | result do_out(
| ^~~~~~
p1454.cpp:300:1: error: 'result' does not name a type
300 | result do_in(
| ^~~~~~
p1454.cpp:313:1: error: 'result' does not name a type
313 | result do_unshift(stateT& state, externT* to, externT* to_end, externT*& to_next) const;
| ^~~~~~
p1454.cpp:321:35: error: non-member function 'int do_encoding()' cannot have cv-qualifier
321 | int do_encoding() const noexcept;
| ^~~~~~~~
p1454.cpp:323:31: error: non-member function 'bool do_always_noconv()' cannot have cv-qualifier
323 | bool do_always_noconv() const noexcept;
| ^~~~~~~~
p1454.cpp:325:15: error: 'stateT' was not declared in this scope; did you mean 'static'?
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~~
| static
p1454.cpp:325:23: error: 'state' was not declared in this scope; did you mean 'static'?
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
| static
p1454.cpp:325:30: error: expected primary-expression before 'const'
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:325:51: error: expected primary-expression before 'const'
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~~~
p1454.cpp:325:83: error: expected primary-expression before 'max'
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^~~
p1454.cpp:325:86: error: expression list treated as compound expression in initializer [-fpermissive]
325 | int do_length(stateT& state, const externT* from, const externT* from_end, size_t max) const;
| ^
p1454.cpp:329:27: error: non-member function 'int do_max_length()' cannot have cv-qualifier
329 | int do_max_length() const noexcept;
| ^~~~~~~~
p1454.cpp:349:30: error: redefinition of default argument for 'class InputIterator'
349 | template<class charT, class InputIterator = istreambuf_iterator<charT>>
| ^~~~~
In file included from /usr/local/include/c++/12.1.0/ios:41:
/usr/local/include/c++/12.1.0/bits/localefwd.h:156:29: note: original definition appeared here
156 | template<typename _CharT, typename _InIter = istreambuf_iterator<_CharT> >
| ^~~~~~~~
p1454.cpp:427:1: error: 'iter_type' does not name a type
427 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:429:1: error: 'iter_type' does not name a type
429 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:431:1: error: 'iter_type' does not name a type
431 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:433:1: error: 'iter_type' does not name a type
433 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:435:1: error: 'iter_type' does not name a type
435 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:437:1: error: 'iter_type' does not name a type
437 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:439:1: error: 'iter_type' does not name a type
439 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:441:1: error: 'iter_type' does not name a type
441 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:443:1: error: 'iter_type' does not name a type
443 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:445:1: error: 'iter_type' does not name a type
445 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:447:1: error: 'iter_type' does not name a type
447 | iter_type get(iter_type in, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:450:20: error: 'err' declared as reference but not initialized
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:450:25: error: expected unqualified-id before 'void'
450 | ios_base::iostate& err, void*& val) const;
| ^~~~
p1454.cpp:458:1: error: 'fmtflags' does not name a type
458 | fmtflags flags = str.flags();
| ^~~~~~~~
p1454.cpp:459:1: error: 'fmtflags' does not name a type
459 | fmtflags basefield = (flags & ios_base::basefield); fmtflags uppercase = (flags & ios_base::uppercase); fmtflags boolalpha = (flags & ios_base::boolalpha);
| ^~~~~~~~
p1454.cpp:459:53: error: 'fmtflags' does not name a type
459 | fmtflags basefield = (flags & ios_base::basefield); fmtflags uppercase = (flags & ios_base::uppercase); fmtflags boolalpha = (flags & ios_base::boolalpha);
| ^~~~~~~~
p1454.cpp:459:105: error: 'fmtflags' does not name a type
459 | d = (flags & ios_base::basefield); fmtflags uppercase = (flags & ios_base::uppercase); fmtflags boolalpha = (flags & ios_base::boolalpha);
| ^~~~~~~~
p1454.cpp:467:8: error: 'char_type' does not name a type
467 | char_type ct = *in;
| ^~~~~~~~~
p1454.cpp:468:17: error: 'src' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~
p1454.cpp:468:26: error: 'atoms' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~~~
p1454.cpp:468:33: error: 'atoms' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~~~
p1454.cpp:468:48: error: 'src' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~
p1454.cpp:468:58: error: 'ct' was not declared in this scope; did you mean 'c'?
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~
| c
p1454.cpp:468:64: error: 'atoms' was not declared in this scope
468 | char c = src[find(atoms, atoms + sizeof(src) - 1, ct) - atoms];
| ^~~~~
p1454.cpp:469:8: error: expected unqualified-id before 'if'
469 | if (ct == use_facet<numpunct<charT>>(loc).decimal_point())
| ^~
p1454.cpp:472:10: error: 'ct' was not declared in this scope; did you mean 'c'?
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~
| c
p1454.cpp:472:35: error: 'charT' was not declared in this scope; did you mean 'char'?
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~~~~
| char
p1454.cpp:472:35: error: template argument 1 is invalid
p1454.cpp:472:43: error: 'loc' was not declared in this scope; did you mean 'log'?
472 | ct == use_facet<numpunct<charT>>(loc).thousands_sep()
| ^~~
| log
p1454.cpp:473:32: error: 'charT' was not declared in this scope; did you mean 'char'?
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~~~
| char
p1454.cpp:473:32: error: template argument 1 is invalid
p1454.cpp:473:40: error: 'loc' was not declared in this scope; did you mean 'log'?
473 | && use_facet<numpunct<charT>>(loc).grouping().length() != 0;
| ^~~
| log
p1454.cpp:476:8: error: 'char_type' does not name a type
476 | char_type atoms[sizeof(src)];
| ^~~~~~~~~
p1454.cpp:477:24: error: 'charT' was not declared in this scope; did you mean 'char'?
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~~~
| char
p1454.cpp:477:24: error: template argument 1 is invalid
p1454.cpp:477:8: error: specializing member '::use_facet<<expression error> >' requires 'template<>' syntax
477 | use_facet<ctype<charT>>(loc).widen(src, src + sizeof(src), atoms);
| ^~~~~~~~~~~~~~~~~~~~~~~
p1454.cpp:498:37: error: redefinition of 'std::ios_base::iostate& err'
498 | ios_base::iostate& err, bool& val) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:498:42: error: expected unqualified-id before 'bool'
498 | ios_base::iostate& err, bool& val) const;
| ^~~~
p1454.cpp:508:30: error: redefinition of default argument for 'class OutputIterator'
508 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:158:29: note: original definition appeared here
158 | template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
| ^~~~~~~~
p1454.cpp:532:4: error: 'iter_type' does not name a type
532 | iter_type put(iter_type out, ios_base& str, char_type fill, bool val) const;
| ^~~~~~~~~
p1454.cpp:533:4: error: 'iter_type' does not name a type
533 | iter_type put(iter_type out, ios_base& str, char_type fill, long val) const;
| ^~~~~~~~~
p1454.cpp:534:4: error: 'iter_type' does not name a type
534 | iter_type put(iter_type out, ios_base& str, char_type fill, long long val) const;
| ^~~~~~~~~
p1454.cpp:535:4: error: 'iter_type' does not name a type
535 | iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
| ^~~~~~~~~
p1454.cpp:536:4: error: 'iter_type' does not name a type
536 | iter_type put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
| ^~~~~~~~~
p1454.cpp:537:4: error: 'iter_type' does not name a type
537 | iter_type put(iter_type out, ios_base& str, char_type fill, double val) const;
| ^~~~~~~~~
p1454.cpp:538:4: error: 'iter_type' does not name a type
538 | iter_type put(iter_type out, ios_base& str, char_type fill, long double val) const;
| ^~~~~~~~~
p1454.cpp:539:4: error: 'iter_type' does not name a type
539 | iter_type put(iter_type out, ios_base& str, char_type fill, const void* val) const;
| ^~~~~~~~~
p1454.cpp:541:1: error: 'iter_type' does not name a type
541 | iter_type do_put(iter_type out, ios_base& str, char_type fill, long val) const;
| ^~~~~~~~~
p1454.cpp:542:1: error: 'iter_type' does not name a type
542 | iter_type do_put(iter_type out, ios_base& str, char_type fill, long long val) const;
| ^~~~~~~~~
p1454.cpp:543:1: error: 'iter_type' does not name a type
543 | iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long val) const;
| ^~~~~~~~~
p1454.cpp:544:1: error: 'iter_type' does not name a type
544 | iter_type do_put(iter_type out, ios_base& str, char_type fill, unsigned long long val) const;
| ^~~~~~~~~
p1454.cpp:545:1: error: 'iter_type' does not name a type
545 | iter_type do_put(iter_type out, ios_base& str, char_type fill, double val) const;
| ^~~~~~~~~
p1454.cpp:546:1: error: 'iter_type' does not name a type
546 | iter_type do_put(iter_type out, ios_base& str, char_type fill, long double val) const;
| ^~~~~~~~~
p1454.cpp:547:1: error: 'iter_type' does not name a type
547 | iter_type do_put(iter_type out, ios_base& str, char_type fill, const void* val) const;
| ^~~~~~~~~
p1454.cpp:549:16: error: 'str' was not declared in this scope; did you mean 'std'?
549 | locale loc = str.getloc();
| ^~~
| std
p1454.cpp:556:8: error: 'fmtflags' does not name a type
556 | fmtflags flags = str.flags();
| ^~~~~~~~
p1454.cpp:557:8: error: 'fmtflags' does not name a type
557 | fmtflags basefield = (flags & (ios_base::basefield));
| ^~~~~~~~
p1454.cpp:558:8: error: 'fmtflags' does not name a type
558 | fmtflags uppercase = (flags & (ios_base::uppercase));
| ^~~~~~~~
p1454.cpp:559:8: error: 'fmtflags' does not name a type
559 | fmtflags floatfield = (flags & (ios_base::floatfield));
| ^~~~~~~~
p1454.cpp:560:8: error: 'fmtflags' does not name a type
560 | fmtflags showpos = (flags & (ios_base::showpos));
| ^~~~~~~~
p1454.cpp:561:8: error: 'fmtflags' does not name a type
561 | fmtflags showbase = (flags & (ios_base::showbase));
| ^~~~~~~~
p1454.cpp:562:8: error: 'fmtflags' does not name a type
562 | fmtflags showpoint = (flags & (ios_base::showpoint));
| ^~~~~~~~
p1454.cpp:576:16: error: 'charT' was not declared in this scope; did you mean 'char'?
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~~~~
| char
p1454.cpp:576:21: error: template argument 1 is invalid
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^
p1454.cpp:576:51: error: 'charT' was not declared in this scope; did you mean 'char'?
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ^~~~~
| char
p1454.cpp:576:51: error: template argument 1 is invalid
p1454.cpp:576:58: error: no matching function for call to 'use_facet<<expression error> >(std::locale&)'
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/local/include/c++/12.1.0/bits/locale_classes.h:857,
from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/12.1.0/ios:42:
/usr/local/include/c++/12.1.0/bits/locale_classes.tcc:132:5: note: candidate: 'template<class _Facet> const _Facet& std::use_facet(const locale&)'
132 | use_facet(const locale& __loc)
| ^~~~~~~~~
/usr/local/include/c++/12.1.0/bits/locale_classes.tcc:132:5: note: template argument deduction/substitution failed:
p1454.cpp:576:58: error: template argument 1 is invalid
576 | const numpunct<charT>& punct = use_facet<numpunct<charT>>(loc);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
p1454.cpp:579:1: error: 'fmtflags' does not name a type
579 | fmtflags adjustfield = (flags & (ios_base::adjustfield));
| ^~~~~~~~
p1454.cpp:587:4: error: 'iter_type' does not name a type
587 | iter_type do_put(iter_type out, ios_base& str, char_type fill, bool val) const;
| ^~~~~~~~~
p1454.cpp:589:3: error: 'string_type' does not name a type
589 | string_type s =
| ^~~~~~~~~~~
p1454.cpp:603:40: error: declaration does not declare anything [-fpermissive]
603 | const;
| ^~~~~
p1454.cpp:604:40: error: declaration does not declare anything [-fpermissive]
604 | const;
| ^~~~~
p1454.cpp:605:40: error: declaration does not declare anything [-fpermissive]
605 | const;
| ^~~~~
p1454.cpp:606:40: error: declaration does not declare anything [-fpermissive]
606 | const;
| ^~~~~
p1454.cpp:607:40: error: declaration does not declare anything [-fpermissive]
607 | const;
| ^~~~~
p1454.cpp:609:1: error: expected ';' at end of member declaration
609 | char_type
| ^~~~~~~~~
| ;
p1454.cpp:609:1: error: 'std::numpunct<charT>::char_type std::numpunct<charT>::char_type' conflicts with a previous declaration
p1454.cpp:600:15: note: previous declaration 'using char_type = charT'
600 | using char_type = charT;
| ^~~~~~~~~
p1454.cpp:611:1: error: expected ';' at end of member declaration
611 | string_type truename()
| ^~~~~~~~~~~
| ;
p1454.cpp:611:1: error: 'std::string std::numpunct<charT>::string_type' conflicts with a previous declaration
p1454.cpp:601:15: note: previous declaration 'using string_type = class std::__cxx11::basic_string<_CharT>'
601 | using string_type = basic_string<charT>;
| ^~~~~~~~~~~
p1454.cpp:611:14: error: ISO C++ forbids declaration of 'truename' with no type [-fpermissive]
611 | string_type truename()
| ^~~~~~~~
p1454.cpp:611:23: error: expected ';' at end of member declaration
611 | string_type truename()
| ^
| ;
p1454.cpp:612:24: error: expected ';' at end of member declaration
612 | string_type falsename()
| ^
| ;
p1454.cpp:614:43: error: duplicate 'virtual'
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~
| -------
p1454.cpp:614:25: error: 'char_type' declared as a 'virtual' field
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~
p1454.cpp:614:51: error: expected ';' at end of member declaration
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~~~
| ;
p1454.cpp:614:51: error: 'std::numpunct<charT>::char_type std::numpunct<charT>::char_type' conflicts with a previous declaration
p1454.cpp:600:15: note: previous declaration 'using char_type = charT'
600 | using char_type = charT;
| ^~~~~~~~~
p1454.cpp:614:76: error: duplicate 'virtual'
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~
| -------
p1454.cpp:614:61: error: 'string_type' declared as a 'virtual' field
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~
p1454.cpp:614:84: error: expected ';' at end of member declaration
614 | protected: ~numpunct(); virtual char_type virtual char_type virtual string virtual string_type virtual string_type
| ^~~~~~~~~~~
| ;
p1454.cpp:614:84: error: 'std::string std::numpunct<charT>::string_type' conflicts with a previous declaration
p1454.cpp:601:15: note: previous declaration 'using string_type = class std::__cxx11::basic_string<_CharT>'
601 | using string_type = basic_string<charT>;
| ^~~~~~~~~~~
p1454.cpp:615:1: error: expected unqualified-id before '}' token
615 | }; }
| ^
p1454.cpp:616:25: error: expected constructor, destructor, or type conversion before ';' token
616 | do_decimal_point() const;
| ^
p1454.cpp:617:25: error: expected constructor, destructor, or type conversion before ';' token
617 | do_thousands_sep() const;
| ^
p1454.cpp:621:1: error: expected constructor, destructor, or type conversion before 'thousands_sep'
621 | thousands_sep()
| ^~~~~~~~~~~~~
p1454.cpp:627:1: error: declaration does not declare anything [-fpermissive]
627 | const;
| ^~~~~
p1454.cpp:628:1: error: declaration does not declare anything [-fpermissive]
628 | const;
| ^~~~~
p1454.cpp:638:1: error: 'char_type' does not name a type
638 | char_type do_decimal_point() const;
| ^~~~~~~~~
p1454.cpp:643:1: error: 'char_type' does not name a type
643 | char_type decimal_point() const;
| ^~~~~~~~~
p1454.cpp:647:1: error: 'string_type' does not name a type
647 | string_type falsename() const;
| ^~~~~~~~~~~
p1454.cpp:648:1: error: expected unqualified-id before '[' token
648 | [facet.numpunct.members]
| ^
p1454.cpp:652:22: error: non-member function 'std::string do_grouping()' cannot have cv-qualifier
652 | string do_grouping() const;
| ^~~~~
p1454.cpp:655:1: error: 'string_type' does not name a type
655 | string_type do_truename() const;
| ^~~~~~~~~~~
p1454.cpp:656:1: error: 'string_type' does not name a type
656 | string_type do_falsename() const;
| ^~~~~~~~~~~
p1454.cpp:662:32: error: reference to 'numpunct' is ambiguous
662 | class numpunct_byname : public numpunct<charT> { // this class is specialized for char and wchar_t. public:
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:162:35: note: candidates are: 'template<class _CharT> class std::__cxx11::numpunct'
162 | template<typename _CharT> class numpunct;
| ^~~~~~~~
p1454.cpp:598:13: note: 'template<class charT> class std::numpunct'
598 | class numpunct : public locale::facet {
| ^~~~~~~~
p1454.cpp:662:40: error: expected template-name before '<' token
662 | class numpunct_byname : public numpunct<charT> { // this class is specialized for char and wchar_t. public:
| ^
p1454.cpp:662:40: error: expected '{' before '<' token
p1454.cpp:698:22: error: 'charT' does not name a type; did you mean 'char'?
698 | int compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:698:41: error: 'charT' does not name a type; did you mean 'char'?
698 | int compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:699:22: error: 'charT' does not name a type; did you mean 'char'?
699 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:699:41: error: 'charT' does not name a type; did you mean 'char'?
699 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:699:55: error: non-member function 'int compare(const int*, const int*, const int*, const int*)' cannot have cv-qualifier
699 | const charT* low2, const charT* high2) const;
| ^~~~~
p1454.cpp:702:17: error: 'charT' does not name a type; did you mean 'char'?
702 | long hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:702:35: error: 'charT' does not name a type; did you mean 'char'?
702 | long hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:702:48: error: non-member function 'long int hash(const int*, const int*)' cannot have cv-qualifier
702 | long hash(const charT* low, const charT* high) const;
| ^~~~~
p1454.cpp:705:22: error: 'charT' does not name a type; did you mean 'char'?
705 | int do_compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:705:41: error: 'charT' does not name a type; did you mean 'char'?
705 | int do_compare(const charT* low1, const charT* high1,
| ^~~~~
| char
p1454.cpp:706:7: error: 'charT' does not name a type; did you mean 'char'?
706 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:706:26: error: 'charT' does not name a type; did you mean 'char'?
706 | const charT* low2, const charT* high2) const;
| ^~~~~
| char
p1454.cpp:706:40: error: non-member function 'int do_compare(const int*, const int*, const int*, const int*)' cannot have cv-qualifier
706 | const charT* low2, const charT* high2) const;
| ^~~~~
p1454.cpp:708:4: error: 'string_type' does not name a type
708 | string_type do_transform(const charT* low, const charT* high) const;
| ^~~~~~~~~~~
p1454.cpp:710:20: error: 'charT' does not name a type; did you mean 'char'?
710 | long do_hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:710:38: error: 'charT' does not name a type; did you mean 'char'?
710 | long do_hash(const charT* low, const charT* high) const;
| ^~~~~
| char
p1454.cpp:710:51: error: non-member function 'long int do_hash(const int*, const int*)' cannot have cv-qualifier
710 | long do_hash(const charT* low, const charT* high) const;
| ^~~~~
p1454.cpp:712:1: error: 'Recommended' does not name a type
712 | Recommended practice: The probability that the result equals that for another string which does not compare equal should be very small, approaching (1.0/numeric_limits<unsigned long>::max()).
| ^~~~~~~~~~~
p1454.cpp:752:62: error: 'const' and 'volatile' function specifiers on 'get_year' invalid in parameter declaration
752 | ios_base::iostate& err, tm* t) const;
| ^~~~~
p1454.cpp:752:67: error: expected ')' before ';' token
752 | ios_base::iostate& err, tm* t) const;
| ^
| )
p1454.cpp:750:19: note: to match this '('
750 | iter_type get_date(iter_type s, iter_type end, ios_base& str,
| ^
p1454.cpp:778:1: error: 'dateorder' does not name a type
778 | dateorder date_order() const;
| ^~~~~~~~~
p1454.cpp:780:1: error: 'iter_type' does not name a type
780 | iter_type get_time(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:782:34: error: redefinition of 'std::ios_base::iostate& err'
782 | ios_base::iostate& err, tm* t) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:782:41: error: expected initializer before '*' token
782 | ios_base::iostate& err, tm* t) const;
| ^
p1454.cpp:784:1: error: 'iter_type' does not name a type
784 | iter_type get_weekday(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:786:1: error: 'iter_type' does not name a type
786 | iter_type get_monthname(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:789:34: error: redefinition of 'std::ios_base::iostate& err'
789 | ios_base::iostate& err, tm* t) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:789:41: error: expected initializer before '*' token
789 | ios_base::iostate& err, tm* t) const;
| ^
p1454.cpp:792:1: error: 'iter_type' does not name a type
792 | iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
| ^~~~~~~~~
p1454.cpp:795:1: error: 'iter_type' does not name a type
795 | iter_type get(iter_type s, iter_type end, ios_base& f, ios_base::iostate& err,
| ^~~~~~~~~
p1454.cpp:808:1: error: 'dateorder' does not name a type
808 | dateorder do_date_order() const;
| ^~~~~~~~~
p1454.cpp:810:1: error: 'iter_type' does not name a type
810 | iter_type do_get_time(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:814:1: error: 'iter_type' does not name a type
814 | iter_type do_get_date(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:818:15: error: expected constructor, destructor, or type conversion before 'Format'
818 | date_order() Format
| ^~~~~~
p1454.cpp:825:1: error: 'iter_type' does not name a type
825 | iter_type do_get_monthname(iter_type s, iter_type end, ios_base& str,
| ^~~~~~~~~
p1454.cpp:829:37: error: redefinition of 'std::ios_base::iostate& err'
829 | ios_base::iostate& err, tm* t) const;
| ^~~
p1454.cpp:450:20: note: 'std::ios_base::iostate& err' previously declared here
450 | ios_base::iostate& err, void*& val) const;
| ^~~
p1454.cpp:829:44: error: expected initializer before '*' token
829 | ios_base::iostate& err, tm* t) const;
| ^
p1454.cpp:832:1: error: 'iter_type' does not name a type
832 | iter_type do_get(iter_type s, iter_type end, ios_base& f,
| ^~~~~~~~~
p1454.cpp:842:38: error: reference to 'time_get' is ambiguous
842 | class time_get_byname : public time_get<charT, InputIterator> {
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:178:11: note: candidates are: 'template<class _CharT, class _InIter> class std::__cxx11::time_get'
178 | class time_get;
| ^~~~~~~~
p1454.cpp:734:13: note: 'template<class charT, class InputIterator> class std::time_get'
734 | class time_get : public locale::facet, public time_base {
| ^~~~~~~~
p1454.cpp:842:46: error: expected template-name before '<' token
842 | class time_get_byname : public time_get<charT, InputIterator> {
| ^
p1454.cpp:842:46: error: expected '{' before '<' token
p1454.cpp:856:27: error: redefinition of default argument for 'class OutputIterator'
856 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:182:29: note: original definition appeared here
182 | template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
| ^~~~~~~~
p1454.cpp:875:1: error: 'iter_type' does not name a type
875 | iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
| ^~~~~~~~~
p1454.cpp:877:1: error: 'iter_type' does not name a type
877 | iter_type put(iter_type s, ios_base& str, char_type fill, const tm* t,
| ^~~~~~~~~
p1454.cpp:881:1: error: 'iter_type' does not name a type
881 | iter_type do_put(iter_type s, ios_base&, char_type fill, const tm* t,
| ^~~~~~~~~
p1454.cpp:890:27: error: redefinition of default argument for 'class OutputIterator'
890 | template<class charT, class OutputIterator = ostreambuf_iterator<charT>>
| ^~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:184:29: note: original definition appeared here
184 | template<typename _CharT, typename _OutIter = ostreambuf_iterator<_CharT> >
| ^~~~~~~~
p1454.cpp:921:1: error: 'iter_type' does not name a type
921 | iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
| ^~~~~~~~~
p1454.cpp:923:1: error: 'iter_type' does not name a type
923 | iter_type get(iter_type s, iter_type end, bool intl, ios_base& f,
| ^~~~~~~~~
p1454.cpp:927:1: error: 'iter_type' does not name a type
927 | iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:929:1: error: 'iter_type' does not name a type
929 | iter_type do_get(iter_type s, iter_type end, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:939:1: error: expected unqualified-id before 'protected'
939 | protected:
| ^~~~~~~~~
p1454.cpp:941:9: error: 'iter_type' does not name a type
941 | virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
| ^~~~~~~~~
p1454.cpp:943:11: error: 'iter_type' does not name a type
943 | virtual iter_type do_get(iter_type, iter_type, bool, ios_base&,
| ^~~~~~~~~
p1454.cpp:946:3: error: expected unqualified-id before 'for'
946 | for (int i = 0; i < n; ++i)
| ^~~
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:23: error: 'n' was not declared in this scope; did you mean 'yn'?
946 | for (int i = 0; i < n; ++i)
| ^
| yn
p1454.cpp:946:19: error: 'i' does not name a type
946 | for (int i = 0; i < n; ++i)
| ^
p1454.cpp:946:26: error: expected unqualified-id before '++' token
946 | for (int i = 0; i < n; ++i)
| ^~
p1454.cpp:948:3: error: 'buf2' does not name a type
948 | buf2[n] = 0;
| ^~~~
p1454.cpp:949:9: error: expected constructor, destructor, or type conversion before '(' token
949 | sscanf(buf2, "%Lf", &units);
| ^
p1454.cpp:951:21: error: redefinition of 'const char src []'
951 | static const char src[] = "0123456789-";
| ^~~
p1454.cpp:475:19: note: 'const char src [29]' previously defined here
475 | static const char src[] = "0123456789abcdefpxABCDEFPX+-";
| ^~~
p1454.cpp:952:3: error: 'charT' does not name a type; did you mean 'char'?
952 | charT atoms[sizeof(src)];
| ^~~~~
| char
p1454.cpp:953:3: error: 'ct' does not name a type
953 | ct.widen(src, src + sizeof(src) - 1, atoms);
| ^~
p1454.cpp:975:1: error: expected identifier before '}' token
975 | }; }
| ^
p1454.cpp:975:1: error: expected ',' or '...' before '}' token
p1454.cpp:974:77: error: expected ')' before '}' token
974 | virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill,
| ~ ^
| )
975 | }; }
| ~
p1454.cpp:974:76: error: expected ';' at end of member declaration
974 | virtual iter_type do_put(iter_type, bool, ios_base&, char_type fill,
| ^
| ;
p1454.cpp:977:7: error: 'string_type' does not name a type
977 | const string_type& digits) const;
| ^~~~~~~~~~~
p1454.cpp:978:1: error: 'iter_type' does not name a type
978 | iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, long double quant) const;
| ^~~~~~~~~
p1454.cpp:979:1: error: 'iter_type' does not name a type
979 | iter_type put(iter_type s, bool intl, ios_base& f, char_type fill, const string_type& quant) const;
| ^~~~~~~~~
p1454.cpp:981:1: error: 'iter_type' does not name a type
981 | iter_type do_put(iter_type s, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:983:1: error: 'iter_type' does not name a type
983 | iter_type do_put(iter_type s, bool intl, ios_base& str,
| ^~~~~~~~~
p1454.cpp:986:8: error: 'ct' does not name a type
986 | ct.widen(buf1, buf1 + sprintf(buf1, "%.0Lf", units), buf2)
| ^~
p1454.cpp:1007:1: error: 'charT' does not name a type; did you mean 'char'?
1007 | charT
| ^~~~~
| char
p1454.cpp:1011:1: error: 'string_type' does not name a type
1011 | string_type positive_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1012:1: error: 'string_type' does not name a type
1012 | string_type negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1013:19: error: non-member function 'int frac_digits()' cannot have cv-qualifier
1013 | int frac_digits() const;
| ^~~~~
p1454.cpp:1014:1: error: 'pattern' does not name a type
1014 | pattern pos_format() const;
| ^~~~~~~
p1454.cpp:1015:1: error: 'pattern' does not name a type
1015 | pattern neg_format() const;
| ^~~~~~~
p1454.cpp:1016:22: error: expected constructor, destructor, or type conversion before ';' token
1016 | decimal_point() const;
| ^
p1454.cpp:1017:22: error: expected constructor, destructor, or type conversion before ';' token
1017 | thousands_sep() const;
| ^
p1454.cpp:1018:22: error: expected constructor, destructor, or type conversion before ';' token
1018 | grouping() const;
| ^
p1454.cpp:1019:19: error: redefinition of 'std::locale::id id'
1019 | static locale::id id;
| ^~
p1454.cpp:938:21: note: 'std::locale::id id' previously declared here
938 | static locale::id id;
| ^~
p1454.cpp:1020:26: error: 'International' was not declared in this scope
1020 | static const bool intl = International;
| ^~~~~~~~~~~~~
p1454.cpp:1021:1: error: expected unqualified-id before 'protected'
1021 | protected:
| ^~~~~~~~~
p1454.cpp:1023:9: error: 'charT' does not name a type; did you mean 'char'?
1023 | virtual charT
| ^~~~~
| char
p1454.cpp:1026:53: error: 'string_type' does not name a type
1026 | virtual string_type do_curr_symbol() const; virtual string_type do_positive_sign() const; virtual string_type do_negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1026:99: error: 'string_type' does not name a type
1026 | ing_type do_curr_symbol() const; virtual string_type do_positive_sign() const; virtual string_type do_negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1027:1: error: 'virtual' outside class declaration
1027 | virtual int do_frac_digits() const;
| ^~~~~~~
p1454.cpp:1027:30: error: non-member function 'int do_frac_digits()' cannot have cv-qualifier
1027 | virtual int do_frac_digits() const;
| ^~~~~
p1454.cpp:1028:9: error: 'pattern' does not name a type
1028 | virtual pattern do_pos_format() const;
| ^~~~~~~
p1454.cpp:1029:9: error: 'pattern' does not name a type
1029 | virtual pattern do_neg_format() const;
| ^~~~~~~
p1454.cpp:1030:25: error: expected constructor, destructor, or type conversion before ';' token
1030 | do_decimal_point() const;
| ^
p1454.cpp:1031:25: error: expected constructor, destructor, or type conversion before ';' token
1031 | do_thousands_sep() const;
| ^
p1454.cpp:1032:25: error: expected constructor, destructor, or type conversion before ';' token
1032 | do_grouping() const;
| ^
p1454.cpp:1041:1: error: 'charT' does not name a type; did you mean 'char'?
1041 | charT do_decimal_point() const;
| ^~~~~
| char
p1454.cpp:1044:1: error: 'defined' does not name a type
1044 | defined identically as the member numpunct<>::do_grouping().
| ^~~~~~~
p1454.cpp:1050:1: error: 'string_type' does not name a type
1050 | string_type positive_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1051:1: error: 'string_type' does not name a type
1051 | string_type negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1052:19: error: non-member function 'int frac_digits()' cannot have cv-qualifier
1052 | int frac_digits() const;
| ^~~~~
p1454.cpp:1053:1: error: 'pattern' does not name a type
1053 | pattern pos_format() const;
| ^~~~~~~
p1454.cpp:1054:1: error: 'pattern' does not name a type
1054 | pattern neg_format() const;
| ^~~~~~~
p1454.cpp:1055:22: error: expected constructor, destructor, or type conversion before ';' token
1055 | decimal_point() const;
| ^
p1454.cpp:1056:22: error: expected constructor, destructor, or type conversion before ';' token
1056 | thousands_sep() const;
| ^
p1454.cpp:1057:22: error: expected constructor, destructor, or type conversion before ';' token
1057 | grouping() const;
| ^
p1454.cpp:1058:1: error: 'charT' does not name a type; did you mean 'char'?
1058 | charT do_thousands_sep() const;
| ^~~~~
| char
p1454.cpp:1061:1: error: 'string_type' does not name a type
1061 | string_type do_curr_symbol() const;
| ^~~~~~~~~~~
p1454.cpp:1064:1: error: 'string_type' does not name a type
1064 | string_type do_positive_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1065:1: error: 'string_type' does not name a type
1065 | string_type do_negative_sign() const;
| ^~~~~~~~~~~
p1454.cpp:1067:22: error: non-member function 'int do_frac_digits()' cannot have cv-qualifier
1067 | int do_frac_digits() const;
| ^~~~~
p1454.cpp:1069:1: error: 'pattern' does not name a type
1069 | pattern do_neg_format() const;
| ^~~~~~~
p1454.cpp:1074:1: error: expected unqualified-id before 'return'
1074 | return an object of type pattern initialized to { symbol, sign, none, value }.270
| ^~~~~~
p1454.cpp:1074:78: error: expected unqualified-id before numeric constant
1074 | return an object of type pattern initialized to { symbol, sign, none, value }.270
| ^~~~
p1454.cpp:1099:17: error: 'unspecified' does not name a type
1099 | using catalog = unspecified signed integer type; };
| ^~~~~~~~~~~
p1454.cpp:1106:9: error: 'catalog' does not name a type
1106 | catalog open(const string& fn, const locale&) const;
| ^~~~~~~
p1454.cpp:1107:25: error: 'catalog' has not been declared
1107 | string_type get(catalog c, int set, int msgid,
| ^~~~~~~
p1454.cpp:1109:20: error: 'catalog' has not been declared
1109 | void close(catalog c) const;
| ^~~~~~~
p1454.cpp:1113:9: error: 'catalog' does not name a type
1113 | virtual catalog do_open(const string&, const locale&) const;
| ^~~~~~~
p1454.cpp:1114:28: error: 'catalog' has not been declared
1114 | virtual string_type do_get(catalog, int set, int msgid,
| ^~~~~~~
p1454.cpp:1116:31: error: 'catalog' has not been declared
1116 | virtual void do_close(catalog) const;
| ^~~~~~~
p1454.cpp:1121:4: error: 'catalog' does not name a type
1121 | catalog open(const string& name, const locale& loc) const;
| ^~~~~~~
p1454.cpp:1123:1: error: 'string_type' does not name a type
1123 | string_type get(catalog cat, int set, int msgid, const string_type& dfault) const;
| ^~~~~~~~~~~
p1454.cpp:1127:1: error: 'catalog' does not name a type
1127 | catalog do_open(const string& name, const locale& loc) const;
| ^~~~~~~
p1454.cpp:1131:1: error: 'string_type' does not name a type
1131 | string_type do_get(catalog cat, int set, int msgid, const string_type& dfault) const;
| ^~~~~~~~~~~
p1454.cpp:1134:9: error: variable or field 'do_close' declared void
1134 | void do_close(catalog cat) const;
| ^~~~~~~~
p1454.cpp:1134:18: error: 'catalog' was not declared in this scope
1134 | void do_close(catalog cat) const;
| ^~~~~~~
p1454.cpp:1140:38: error: reference to 'messages' is ambiguous
1140 | class messages_byname : public messages<charT> {
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/localefwd.h:206:11: note: candidates are: 'template<class _CharT> class std::__cxx11::messages'
206 | class messages;
| ^~~~~~~~
p1454.cpp:1101:13: note: 'template<class charT> class std::messages'
1101 | class messages : public locale::facet, public messages_base {
| ^~~~~~~~
p1454.cpp:1140:46: error: expected template-name before '<' token
1140 | class messages_byname : public messages<charT> {
| ^
p1454.cpp:1140:46: error: expected '{' before '<' token
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
応用例1 AUTOSAR C++
AUTOSARでC++のコーディング標準を作っている。
MISRA-C++コーディング標準の改訂をまたずに、C++14に対応したかったためかもしれない。
Autosar Guidelines C++14 example code compile list
MISRA C++, AUTOSAR C++について
応用例2 MISRA C/C++
MISRA C まとめ #include
MISRA C++ 5-0-16
応用例3 CERT C/C++
SEI CERT C++ Coding Standard AA. Bibliography 確認中。
MISRA C/C++, AUTOSAR C++, CERT C/C++とC/C++工業標準をコンパイルする
応用例4 箱庭
箱庭もくもく会 #10 日時:2022/09/14(水) 17:30-19:30
箱庭ではUnityをはじめC++を使っているらしい。
ここでコンパイルしたコードと同じようなコードを使っているか、
ここで出たコンパイルエラーと同じようなエラーがでたかを
いろいろな版のコンパイラでコンパイルして確認していく。
この項目は、箱庭プロジェクトを市場分析の対象として、原則的には、箱庭プロジェクトの外部から分析し、外部から箱庭の広告宣伝のための戦略会議を仮想した結果、仮想「箱庭もくもく会」を開催してみることを企画するものである。
一切の内容は、箱庭プロジェクト、Athrill, TOPPERSとは無関係である。
一(いち)参加データアナリストの、個人的なつぶやきです。
仮想戦略会議「箱庭」
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(1)
お盆には「箱庭」記事を書きましょう「もくもく会」の題材になる(2)
エンジニア夏休み企画
個人開発と読書感想文に焦点を当てたのは良い企画だと思った。
個人開発
【個人開発】 効率的な背景 <エンジニア夏休み企画>
Cコンパイラの試験を一人でもくもくとやっているのは個人開発の一つの姿です。
読書感想文
CコンパイラによるC言語規格の読書感想文として掲載しています。
コンパイル実験が、C++N4910に対する、G++とClang++による感想文だということご理解いただけると幸いです。
読書感想文は人間かAIだけが作るものとは限りません。
本(電子書籍を含む)を入力として、その内容に対する文字列を読書感想文として受け止めましょう。
元の文章をあり方、コンパイルできるように電子化しておくこと、コンパイラが解釈可能な断片の作り方など。
自己参考資料(self reference)
関連する自己参照以外は、こちらの先頭に移転。
C言語(C++)に対する誤解、曲解、無理解、爽快。
#include "N4910.h"
C++N4910資料の改善点
dockerにclang
docker gnu(gcc/g++) and llvm(clang/clang++)
コンパイル用shell script C版(clangとgcc)とC++版(clang++とg++)
C++N4910:2022 tag follower 300人超えました。ありがとうございます。
astyle 使ってみた
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220823