g++ でありがたいことがある。
コンパイルすると、includeファイルが足りないと、候補を示してくれる。
これむっちゃ助かる。
22.6.3.7 Swap [variant.swap] C++N4910:2022 (567) p707a.cpp
bash
$ g++ p707a.cpp -std=2b -o p707ag -I. -Wall
p707a.cpp:28:162: error: too many decimal points in number
28 | onstructible_v<Ti> is true for all i. Preconditions: Lvalues of type Ti are swappable (16.4.4.3).
| ^~~~~~~~
p707a.cpp:28:16: error: variable or field 'swap' declared void
28 | constexpr void swap(variant& rhs) noexcept(see below); Mandates: is_move_constructible_v<Ti> is true for all i. Preconditions: Lvalues of type Ti are swappable (16.4.4.3).
| ^~~~
p707a.cpp:28:21: error: 'variant' was not declared in this scope
28 | constexpr void swap(variant& rhs) noexcept(see below); Mandates: is_move_constructible_v<Ti> is true for all i. Preconditions: Lvalues of type Ti are swappable (16.4.4.3).
| ^~~~~~~
p707a.cpp:23:1: note: 'std::variant' is defined in header '<variant>'; did you forget to '#include <variant>'?
22 | #include <memory>
+++ |+#include <variant>
23 | #include <typeinfo>
p707a.cpp:28:30: error: 'rhs' was not declared in this scope
28 | constexpr void swap(variant& rhs) noexcept(see below); Mandates: is_move_constructible_v<Ti> is true for all i. Preconditions: Lvalues of type Ti are swappable (16.4.4.3).
| ^~~
p707a.cpp:28:64: error: found ':' in nested-name-specifier, expected '::'
28 | constexpr void swap(variant& rhs) noexcept(see below); Mandates: is_move_constructible_v<Ti> is true for all i. Preconditions: Lvalues of type Ti are swappable (16.4.4.3).
| ^
| ::
p707a.cpp:28:56: error: 'Mandates' does not name a type
28 | constexpr void swap(variant& rhs) noexcept(see below); Mandates: is_move_constructible_v<Ti> is true for all i. Preconditions: Lvalues of type Ti are swappable (16.4.4.3).
|