0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

22.9.2.3 Members [bitset.members] C++N4910:2022 (610) p735.cpp

Posted at

はじめに(Introduction)

N4910 Working Draft, Standard for Programming Language C++

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

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

背景(back ground)

C/C++でコンパイルエラーが出ると、途方にくれることがしばしばあります。
何回かに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.

算譜(source code)

p7.cpp
// C++N4910 Committee Draft, Standard for Programming Language C++
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/n4910.pdf
const char * n4910 = "";
// 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

"N4910.h"

using namespace std;

// Example 1  
bitset& operator&=(const bitset& rhs) noexcept;
// Effects: Clears each bit in *this for which the corresponding bit in rhs is clear, and leaves all other bits unchanged.
// Returns: *this.
bitset& operator|=(const bitset& rhs) noexcept;
// Effects: Sets each bit in *this for which the corresponding bit in rhs is set, and leaves all other bits unchanged.
// Returns: *this.
bitset& operator^=(const bitset& rhs) noexcept;
// Effects: Toggles each bit in *this for which the corresponding bit in rhs is set, and leaves all other bits unchanged.
// Returns: *this.
bitset& operator<<=(size_t pos) noexcept;
// Effects: Replaces each bit at position I in *this with a value determined as follows: 
// — If I < pos, the new value is zero;
// — If I >= pos, the new value is the previous value of the bit at position I - pos.
// Returns: *this.
bitset& operator>>=(size_t pos) noexcept;
// Effects: Replaces each bit at position I in *this with a value determined as follows:
// — If pos >= N - I,thenewvalueiszero;
// — If pos < N - I,thenewvalueisthepreviousvalueofthebitatpositionI + pos.
// Returns: *this.
bitset& set() noexcept;
// Effects: Sets all bits in *this. Returns: *this.
bitset& set(size_t pos, bool val = true);
// Effects: Stores a new value in the bit at position pos in *this. If val is true, the stored value is one, otherwise it is zero.
// Returns: *this.
// Throws: out_of_range if pos does not correspond to a valid bit position.
bitset& reset() noexcept;
// Effects: Resets all bits in *this. Returns: *this.
bitset& reset(size_t pos);
// Effects: Resets the bit at position pos in *this.
// Returns: *this.
// Throws: out_of_range if pos does not correspond to a valid bit position.
bitset operator~() const noexcept;
// Effects: Constructs an object x of class bitset and initializes it with *this. Returns: x.flip().
// Effects: Toggles all bits in *this. Returns: *this.
bitset& flip(size_t pos);
// Effects: Toggles the bit at position pos in *this.
// Returns: *this.
// Throws: out_of_range if pos does not correspond to a valid bit position.
unsigned long to_ulong() const;
// Returns: x.
// Throws: overflow_error if the integral value x corresponding to the bits in *this cannot be represented as type unsigned long.
unsigned long long to_ullong() const;
// Returns: x.
// Throws: overflow_error if the integral value x corresponding to the bits in *this cannot be represented as type unsigned long long.
template<class charT = char,
         class traits = char_traits<charT>,
       class Allocator = allocator<charT>>
basic_string<charT, traits, Allocator>
  to_string(charT zero = charT(0), charT one = charT(1)) const;
// Effects: Constructs a string object of the appropriate type and initializes it to a string of length N characters. Each character is determined by the value of its corresponding bit position in *this. Character position N - 1 corresponds to bit position zero. Subsequent decreasing character positions correspond to increasing bit positions. Bit value zero becomes the character zero, bit value one becomes the character one.
// Returns: The created object. 
size_t count() const noexcept;
// Returns: A count of the number of bits set in *this. 
constexpr size_t size() const noexcept;
// Returns: N.
bool operator==(const bitset& rhs) const noexcept;
// Returns: true if the value of each bit in *this equals the value of the corresponding bit in rhs.
bool test(size_t pos) const;
// Returns: true if the bit at position pos in *this has the value one. 
// Throws: out_of_range if pos does not correspond to a valid bit position.
bool all() const noexcept;
// Returns: count() == size(). 
bool any() const noexcept;
// Returns: count() != 0. 
bool none() const noexcept;
// Returns: count() == 0.
bitset operator<<(size_t pos) const noexcept;
// Returns: bitset(*this) <<= pos.
bitset operator>>(size_t pos) const noexcept;
// Returns: bitset(*this) >>= pos.
constexpr bool operator[](size_t pos) const;
// Preconditions: pos is valid.
// Returns: true if the bit at position pos in *this has the value one, otherwise false. 
// Throws: Nothing.
bitset::reference operator[](size_t pos);
// Preconditions: pos is valid.
// Returns: An object of type bitset::reference such that (*this)[pos] == this->test(pos), and such that (*this)[pos] = val is equivalent to this->set(pos, val).
// Throws: Nothing.
// Remarks: For the purpose of determining the presence of a data race (6.9.2), any access or update through the resulting reference potentially accesses or modifies, respectively, the entire underlying bitset.
int main(){
  cout  <<  n4910 << endl;
  return EXIT_SUCCESS;
}

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

bash
$ clang++ p735.cpp -std=03 -o p735l -I. -Wall
In file included from p735.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 \
 ^
p735.cpp:15:1: error: unknown type name 'bitset'
bitset& operator&=(const bitset& rhs) noexcept;
^
p735.cpp:15:26: error: unknown type name 'bitset'
bitset& operator&=(const bitset& rhs) noexcept;
                         ^
p735.cpp:15:39: error: expected function body after function declarator
bitset& operator&=(const bitset& rhs) noexcept;
                                      ^
p735.cpp:18:1: error: unknown type name 'bitset'
bitset& operator|=(const bitset& rhs) noexcept;
^
p735.cpp:18:26: error: unknown type name 'bitset'
bitset& operator|=(const bitset& rhs) noexcept;
                         ^
p735.cpp:18:39: error: expected function body after function declarator
bitset& operator|=(const bitset& rhs) noexcept;
                                      ^
p735.cpp:21:1: error: unknown type name 'bitset'
bitset& operator^=(const bitset& rhs) noexcept;
^
p735.cpp:21:26: error: unknown type name 'bitset'
bitset& operator^=(const bitset& rhs) noexcept;
                         ^
p735.cpp:21:39: error: expected function body after function declarator
bitset& operator^=(const bitset& rhs) noexcept;
                                      ^
p735.cpp:24:1: error: unknown type name 'bitset'
bitset& operator<<=(size_t pos) noexcept;
^
p735.cpp:24:33: error: expected function body after function declarator
bitset& operator<<=(size_t pos) noexcept;
                                ^
p735.cpp:29:1: error: unknown type name 'bitset'
bitset& operator>>=(size_t pos) noexcept;
^
p735.cpp:29:33: error: expected function body after function declarator
bitset& operator>>=(size_t pos) noexcept;
                                ^
p735.cpp:34:1: error: unknown type name 'bitset'
bitset& set() noexcept;
^
p735.cpp:34:15: error: expected function body after function declarator
bitset& set() noexcept;
              ^
p735.cpp:36:1: error: unknown type name 'bitset'
bitset& set(size_t pos, bool val = true);
^
p735.cpp:40:1: error: unknown type name 'bitset'
bitset& reset() noexcept;
^
p735.cpp:40:17: error: expected function body after function declarator
bitset& reset() noexcept;
                ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ clang++ p735.cpp -std=2b -o p735l -I. -Wall
p735.cpp:15:1: error: unknown type name 'bitset'
bitset& operator&=(const bitset& rhs) noexcept;
^
p735.cpp:15:26: error: unknown type name 'bitset'
bitset& operator&=(const bitset& rhs) noexcept;
                         ^
p735.cpp:18:1: error: unknown type name 'bitset'
bitset& operator|=(const bitset& rhs) noexcept;
^
p735.cpp:18:26: error: unknown type name 'bitset'
bitset& operator|=(const bitset& rhs) noexcept;
                         ^
p735.cpp:21:1: error: unknown type name 'bitset'
bitset& operator^=(const bitset& rhs) noexcept;
^
p735.cpp:21:26: error: unknown type name 'bitset'
bitset& operator^=(const bitset& rhs) noexcept;
                         ^
p735.cpp:24:1: error: unknown type name 'bitset'
bitset& operator<<=(size_t pos) noexcept;
^
p735.cpp:29:1: error: unknown type name 'bitset'
bitset& operator>>=(size_t pos) noexcept;
^
p735.cpp:34:1: error: unknown type name 'bitset'
bitset& set() noexcept;
^
p735.cpp:36:1: error: unknown type name 'bitset'
bitset& set(size_t pos, bool val = true);
^
p735.cpp:40:1: error: unknown type name 'bitset'
bitset& reset() noexcept;
^
p735.cpp:42:1: error: unknown type name 'bitset'
bitset& reset(size_t pos);
^
p735.cpp:46:1: error: unknown type name 'bitset'
bitset operator~() const noexcept;
^
p735.cpp:46:20: error: non-member function cannot have 'const' qualifier
bitset operator~() const noexcept;
                   ^~~~~~
p735.cpp:49:1: error: unknown type name 'bitset'
bitset& flip(size_t pos);
^
p735.cpp:53:26: error: non-member function cannot have 'const' qualifier
unsigned long to_ulong() const;
                         ^~~~~
p735.cpp:56:32: error: non-member function cannot have 'const' qualifier
unsigned long long to_ullong() const;
                               ^~~~~
p735.cpp:63:32: error: unexpected character <U+2019>
  to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
                               ^
p735.cpp:63:36: error: character <U+2019> not allowed in an identifier
  to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

$ g++ p735.cpp -std=03 -o p735g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
                 from N4910.h:11,
                 from p735.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 \
      |  ^~~~~
p735.cpp:15:39: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
   15 | bitset& operator&=(const bitset& rhs) noexcept;
      |                                       ^~~~~~~~
p735.cpp:63:32: error: extended character ’ is not valid in an identifier
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                ^
p735.cpp:63:32: error: extended character ’ is not valid in an identifier
p735.cpp:63:56: error: extended character ’ is not valid in an identifier
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                                        ^
p735.cpp:63:56: error: extended character ’ is not valid in an identifier
p735.cpp:68:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
   68 | constexpr size_t size() const noexcept;
      | ^~~~~~~~~
p735.cpp:15:1: error: 'bitset' does not name a type
   15 | bitset& operator&=(const bitset& rhs) noexcept;
      | ^~~~~~
p735.cpp:18:1: error: 'bitset' does not name a type
   18 | bitset& operator|=(const bitset& rhs) noexcept;
      | ^~~~~~
p735.cpp:21:1: error: 'bitset' does not name a type
   21 | bitset& operator^=(const bitset& rhs) noexcept;
      | ^~~~~~
p735.cpp:24:1: error: 'bitset' does not name a type
   24 | bitset& operator<<=(size_t pos) noexcept;
      | ^~~~~~
p735.cpp:29:1: error: 'bitset' does not name a type
   29 | bitset& operator>>=(size_t pos) noexcept;
      | ^~~~~~
p735.cpp:34:1: error: 'bitset' does not name a type
   34 | bitset& set() noexcept;
      | ^~~~~~
p735.cpp:36:1: error: 'bitset' does not name a type
   36 | bitset& set(size_t pos, bool val = true);
      | ^~~~~~
p735.cpp:40:1: error: 'bitset' does not name a type
   40 | bitset& reset() noexcept;
      | ^~~~~~
p735.cpp:42:1: error: 'bitset' does not name a type
   42 | bitset& reset(size_t pos);
      | ^~~~~~
p735.cpp:46:1: error: 'bitset' does not name a type
   46 | bitset operator~() const noexcept;
      | ^~~~~~
p735.cpp:49:1: error: 'bitset' does not name a type
   49 | bitset& flip(size_t pos);
      | ^~~~~~
p735.cpp:53:26: error: non-member function 'long unsigned int to_ulong()' cannot have cv-qualifier
   53 | unsigned long to_ulong() const;
      |                          ^~~~~
p735.cpp:56:32: error: non-member function 'long long unsigned int to_ullong()' cannot have cv-qualifier
   56 | unsigned long long to_ullong() const;
      |                                ^~~~~
p735.cpp:61:41: error: spurious '>>', use '>' to terminate a template argument list
   61 |        class Allocator = allocator<charT>>
      |                                         ^~
p735.cpp:62:29: error: 'Allocator' was not declared in this scope; did you mean 'alloca'?
   62 | basic_string<charT, traits, Allocator>
      |                             ^~~~~~~~~
      |                             alloca
p735.cpp:62:38: error: template argument 3 is invalid
   62 | basic_string<charT, traits, Allocator>
      |                                      ^
p735.cpp:61:26: error: two or more data types in declaration of 'type name'
   61 |        class Allocator = allocator<charT>>
      |                          ^~~~~~~~~~~~~~~~~
p735.cpp:63:3: error: expected '>' before 'to_string'
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |   ^~~~~~~~~
p735.cpp:63:67: error: expected unqualified-id before ';' token
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                                                   ^
p735.cpp:66:22: error: expected initializer before 'noexcept'
   66 | size_t count() const noexcept;
      |                      ^~~~~~~~
p735.cpp:68:1: error: 'constexpr' does not name a type
   68 | constexpr size_t size() const noexcept;
      | ^~~~~~~~~
p735.cpp:68:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p735.cpp:70:23: error: 'bitset' does not name a type
   70 | bool operator==(const bitset& rhs) const noexcept;
      |                       ^~~~~~
p735.cpp:70:42: error: expected initializer before 'noexcept'
   70 | bool operator==(const bitset& rhs) const noexcept;
      |                                          ^~~~~~~~
p735.cpp:72:23: error: non-member function 'bool test(size_t)' cannot have cv-qualifier
   72 | bool test(size_t pos) const;
      |                       ^~~~~
p735.cpp:75:18: error: expected initializer before 'noexcept'
   75 | bool all() const noexcept;
      |                  ^~~~~~~~
p735.cpp:77:18: error: expected initializer before 'noexcept'
   77 | bool any() const noexcept;
      |                  ^~~~~~~~
p735.cpp:79:19: error: expected initializer before 'noexcept'
   79 | bool none() const noexcept;
      |                   ^~~~~~~~
p735.cpp:81:1: error: 'bitset' does not name a type
   81 | bitset operator<<(size_t pos) const noexcept;
      | ^~~~~~
p735.cpp:83:1: error: 'bitset' does not name a type
   83 | bitset operator>>(size_t pos) const noexcept;
      | ^~~~~~
p735.cpp:85:1: error: 'constexpr' does not name a type
   85 | constexpr bool operator[](size_t pos) const;
      | ^~~~~~~~~
p735.cpp:85:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p735.cpp:89:1: error: 'bitset' does not name a type
   89 | bitset::reference operator[](size_t pos);
      | ^~~~~~

$ g++ p735.cpp -std=2b -o p735g -I. -Wall
p735.cpp:63:32: error: extended character ’ is not valid in an identifier
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                ^
p735.cpp:63:32: error: extended character ’ is not valid in an identifier
p735.cpp:63:56: error: extended character ’ is not valid in an identifier
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                                        ^
p735.cpp:63:56: error: extended character ’ is not valid in an identifier
p735.cpp:15:1: error: 'bitset' does not name a type
   15 | bitset& operator&=(const bitset& rhs) noexcept;
      | ^~~~~~
p735.cpp:18:1: error: 'bitset' does not name a type
   18 | bitset& operator|=(const bitset& rhs) noexcept;
      | ^~~~~~
p735.cpp:21:1: error: 'bitset' does not name a type
   21 | bitset& operator^=(const bitset& rhs) noexcept;
      | ^~~~~~
p735.cpp:24:1: error: 'bitset' does not name a type
   24 | bitset& operator<<=(size_t pos) noexcept;
      | ^~~~~~
p735.cpp:29:1: error: 'bitset' does not name a type
   29 | bitset& operator>>=(size_t pos) noexcept;
      | ^~~~~~
p735.cpp:34:1: error: 'bitset' does not name a type
   34 | bitset& set() noexcept;
      | ^~~~~~
p735.cpp:36:1: error: 'bitset' does not name a type
   36 | bitset& set(size_t pos, bool val = true);
      | ^~~~~~
p735.cpp:40:1: error: 'bitset' does not name a type
   40 | bitset& reset() noexcept;
      | ^~~~~~
p735.cpp:42:1: error: 'bitset' does not name a type
   42 | bitset& reset(size_t pos);
      | ^~~~~~
p735.cpp:46:1: error: 'bitset' does not name a type
   46 | bitset operator~() const noexcept;
      | ^~~~~~
p735.cpp:49:1: error: 'bitset' does not name a type
   49 | bitset& flip(size_t pos);
      | ^~~~~~
p735.cpp:53:26: error: non-member function 'long unsigned int to_ulong()' cannot have cv-qualifier
   53 | unsigned long to_ulong() const;
      |                          ^~~~~
p735.cpp:56:32: error: non-member function 'long long unsigned int to_ullong()' cannot have cv-qualifier
   56 | unsigned long long to_ullong() const;
      |                                ^~~~~
p735.cpp:63:32: error: '\U000020190\U00002019' was not declared in this scope
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                ^~~
p735.cpp:63:56: error: '\U000020191\U00002019' was not declared in this scope
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                                        ^~~
p735.cpp:63:62: error: non-member function 'std::__cxx11::basic_string<_CharT, _Traits, _Allocator> to_string(charT, charT)' cannot have cv-qualifier
   63 |   to_string(charT zero = charT(’0’), charT one = charT(’1’)) const;
      |                                                              ^~~~~
p735.cpp:66:22: error: non-member function 'size_t count()' cannot have cv-qualifier
   66 | size_t count() const noexcept;
      |                      ^~~~~~~~
p735.cpp:68:31: error: non-member function 'constexpr size_t size()' cannot have cv-qualifier
   68 | constexpr size_t size() const noexcept;
      |                               ^~~~~~~~
p735.cpp:70:23: error: 'bitset' does not name a type
   70 | bool operator==(const bitset& rhs) const noexcept;
      |                       ^~~~~~
p735.cpp:70:42: error: non-member function 'bool operator==(const int&)' cannot have cv-qualifier
   70 | bool operator==(const bitset& rhs) const noexcept;
      |                                          ^~~~~~~~
p735.cpp:70:6: error: 'bool operator==(const int&)' must have an argument of class or enumerated type
   70 | bool operator==(const bitset& rhs) const noexcept;
      |      ^~~~~~~~
p735.cpp:72:23: error: non-member function 'bool test(size_t)' cannot have cv-qualifier
   72 | bool test(size_t pos) const;
      |                       ^~~~~
p735.cpp:75:18: error: non-member function 'bool all()' cannot have cv-qualifier
   75 | bool all() const noexcept;
      |                  ^~~~~~~~
p735.cpp:77:18: error: non-member function 'bool any()' cannot have cv-qualifier
   77 | bool any() const noexcept;
      |                  ^~~~~~~~
p735.cpp:79:19: error: non-member function 'bool none()' cannot have cv-qualifier
   79 | bool none() const noexcept;
      |                   ^~~~~~~~
p735.cpp:81:1: error: 'bitset' does not name a type
   81 | bitset operator<<(size_t pos) const noexcept;
      | ^~~~~~
p735.cpp:83:1: error: 'bitset' does not name a type
   83 | bitset operator>>(size_t pos) const noexcept;
      | ^~~~~~
p735.cpp:85:39: error: non-member function 'constexpr bool operator[](size_t)' cannot have cv-qualifier
   85 | constexpr bool operator[](size_t pos) const;
      |                                       ^~~~~
p735.cpp:85:16: error: 'constexpr bool operator[](size_t)' must be a non-static member function
   85 | constexpr bool operator[](size_t pos) const;
      |                ^~~~~~~~
p735.cpp:89:1: error: 'bitset' does not name a type
   89 | bitset::reference operator[](size_t pos);
      | ^~~~~~

検討事項(agenda)

コンパイルエラーを取るか、コンパイルエラーの理由を解説する。

参考資料(reference)

@kazuo_reve 私が効果を確認した「小川メソッド」

自己参照(self reference)

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

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

#include "N4910.h"

C++N4910資料の改善点

ockerにclang

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

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

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

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

コピペコンパイルエラーあるある

C++ Error Message Collection(1)does not name a type, 11 articles

dockerにclang

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

Compare the contents of C++N4910:2022, C++N4741:2018 and C++N4606:2015

C++ sample list

clang++, g++コンパイルエラー方針の違いの例

astyle 使ってみた

DoCAP(ドゥーキャップ)って何ですか?

小川メソッド 覚え(書きかけ)

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

文書履歴(document history)

ver. 0.01 初稿  20220730

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?