はじめに(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.
25.5 Iterator adaptors [predef.iterators]C++N4910:2022 (647) p998.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 = "25.5 Iterator adaptors [predef.iterators]C++N4910:2022 (647) p998.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;
// 25.5.1 Reverse iterators [reverse.iterators]
// 25.5.1.1 General [reverse.iterators.general]
// Class template reverse_iterator is an iterator adaptor that iterates from the end of the sequence defined by its underlying iterator to the beginning of that sequence.
// 25.5.1.2 Class template reverse_iterator [reverse.iterator]
namespace std {
template<class Iterator>
class reverse_iterator {
public:
using iterator_type = Iterator;
using iterator_concept = see_below ;
using iterator_category = see_below ;
using value_type = iter_value_t<Iterator>;
using difference_type = iter_difference_t<Iterator>;
using pointer = typename iterator_traits<Iterator>::pointer;
using reference = iter_reference_t<Iterator>;
constexpr reverse_iterator();
constexpr explicit reverse_iterator(Iterator x);
template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
template<class U> constexpr reverse_iterator& operator=(const reverse_iterator<U>& u);
constexpr Iterator base() const;
constexpr reference operator*() const;
constexpr pointer operator->() const requires see_below;
constexpr reverse_iterator& operator++();
constexpr reverse_iterator operator++(int);
constexpr reverse_iterator& operator--();
constexpr reverse_iterator operator--(int);
constexpr reverse_iterator operator+ (difference_type n) const;
constexpr reverse_iterator& operator+=(difference_type n);
constexpr reverse_iterator operator- (difference_type n) const;
constexpr reverse_iterator& operator-=(difference_type n);
constexpr unspecified operator[](difference_type n) const;
// — operator+, operator-, operator+=, operator-= (25.5.1.7), or
friend constexpr iter_rvalue_reference_t<Iterator> iter_move(const reverse_iterator& i) noexcept(see_below);
template<indirectly_swappable<Iterator> Iterator2>
friend constexpr void
iter_swap(const reverse_iterator& x,
const reverse_iterator<Iterator2>& y) noexcept(see_below);
protected:
Iterator current;
};
}
// The member typedef-name iterator_concept denotes
// — random_access_iterator_tag if Iterator models random_access_iterator, and
// The template parameter Iterator shall either meet the requirements of a Cpp17BidirectionalIterator (25.3.5.6) or model bidirectional_iterator (25.3.4.12).
// Additionally, Iterator shall either meet the requirements of a Cpp17RandomAccessIterator (25.3.5.7) or model random_access_iterator (25.3.4.13) if the definitions of any of the members
// — bidirectional_iterator_tag otherwise.
// The member typedef-name iterator_category denotes
// — random_access_iterator_tag if the type iterator_traits<Iterator>::iterator_category mod- els derived_from<random_access_iterator_tag>, and
// — iterator_traits<Iterator>::iterator_category otherwise.
// 25.5.1.3 Requirements [reverse.iter.requirements]
// — operator[] (25.5.1.6), or the non-member operators (25.5.1.8)
// — operator<, operator>, operator<=, operator>=, operator-, or operator+ (25.5.1.9) are instantiated (13.9.2).
// 25.5.1.4 Construction and assignment [reverse.iter.cons]
constexpr reverse_iterator();
// Effects: Value-initializes current. Iterator operations applied to the resulting iterator have defined behavior if and only if the corresponding operations are defined on a value-initialized iterator of type Iterator.
constexpr explicit reverse_iterator(Iterator x);
// Effects: Initializes current with x.
template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
// Constraints: is_same_v<U, Iterator> is false and const U& models convertible_to<Iterator>. Effects: Initializes current with u.current.
template<class U>
constexpr reverse_iterator&
operator=(const reverse_iterator<U>& u);
// Constraints: is_same_v<U, Iterator> is false, const U& models convertible_to<Iterator>, and assignable_from<Iterator&, const U&> is modeled.
// Effects: Assigns u.current to current. Returns: *this.
// Effects: As if by:
Iterator tmp = current;
return *--tmp;
// 25.5.1.5 Conversion [reverse.iter.conv]
constexpr Iterator base() const;
// Returns: current.
// 25.5.1.6 Element access [reverse.iter.elem]
constexpr reference operator*() const;
// explicit
constexpr pointer operator->() const
requires (is_pointer_v<Iterator> ||
requires(const Iterator i) {
i.operator->();
});
// Effects:— If Iterator is a pointer type, equivalent to: return prev(current); — Otherwise, equivalent to: return prev(current).operator->();
constexpr unspecified operator[](difference_type n) const; // Returns: current[-n-1].
// 25.5.1.7 Navigation [reverse.iter.nav]
constexpr reverse_iterator operator+(difference_type n) const;
// Returns: reverse_iterator(current-n).
constexpr reverse_iterator operator-(difference_type n) const;
// Returns: reverse_iterator(current+n).
constexpr reverse_iterator& operator++();
// Effects: As if by: --current; Returns: *this.
constexpr reverse_iterator operator++(int);
// Effects: As if by:
reverse_iterator tmp = *this;
--current;
return tmp;
constexpr reverse_iterator& operator--();
// Effects: As if by ++current. Returns: *this.
constexpr reverse_iterator operator--(int);
// Effects: As if by:
reverse_iterator tmp = *this;
++current;
return tmp;
constexpr reverse_iterator& operator+=(difference_type n);
// Effects: As if by: current -= n; Returns: *this.
constexpr reverse_iterator& operator-=(difference_type n);
// Effects: As if by: current += n; Returns: *this.
template<class Iterator1, class Iterator2>
constexpr bool operator!=(
// 25.5.1.8 Comparisons [reverse.iter.cmp]
template<class Iterator1, class Iterator2>
constexpr bool operator==(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Constraints: x.base() == y.base() is well-formed and convertible to bool. Returns: x.base() == y.base().
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Constraints: x.base() != y.base() is well-formed and convertible to bool. Returns: x.base() != y.base().
template<class Iterator1, class Iterator2>
constexpr bool operator<(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Constraints: x.base() > y.base() is well-formed and convertible to bool. Returns: x.base() > y.base().
template<class Iterator1, class Iterator2>
constexpr bool operator>(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Constraints: x.base() < y.base() is well-formed and convertible to bool. Returns: x.base() < y.base().
template<class Iterator1, class Iterator2>
constexpr bool operator<=(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Constraints: x.base() >= y.base() is well-formed and convertible to bool. Returns: x.base() >= y.base().
template<class Iterator1, class Iterator2>
constexpr bool operator>=(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Constraints: x.base() <= y.base() is well-formed and convertible to bool. Returns: x.base() <= y.base().
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y);
// Returns: y.base() <=> x.base().
// [Note 1: The argument order in the Returns: element is reversed because this is a reverse iterator.
// 25.5.1.9 Non-member functions [reverse.iter.nonmember]
template<class Iterator1, class Iterator2>
constexpr auto operator-(
const reverse_iterator<Iterator1>& x,
const reverse_iterator<Iterator2>& y) -> decltype(y.base() - x.base());
// Returns: y.base() - x.base().
// Returns: reverse_iterator<Iterator>(x.base() - n). friend constexpr iter_rvalue_reference_t<Iterator>
template<class Iterator>
constexpr reverse_iterator<Iterator> operator+(
iter_difference_t<Iterator> n,
const reverse_iterator<Iterator>& x);
iter_move(const reverse_iterator& i) noexcept(see_below); // Effects: Equivalent to:
auto tmp = i.base();
return ranges::iter_move(--tmp);
// Remarks: The exception specification is equivalent to: is_nothrow_copy_constructible_v<Iterator> &&
noexcept(ranges::iter_move(--declval<Iterator&>()))
template<indirectly_swappable<Iterator> Iterator2>
friend constexpr void
iter_swap(const reverse_iterator& x,
const reverse_iterator<Iterator2>& y) noexcept(see_below);
// Effects: Equivalent to:
auto xtmp = x.base();
auto ytmp = y.base();
ranges::iter_swap(--xtmp, --ytmp);
// Remarks: The exception specification is equivalent to:
is_nothrow_copy_constructible_v<Iterator> &&
is_nothrow_copy_constructible_v<Iterator2> &&
noexcept(ranges::iter_swap(--declval<Iterator&>(), --declval<Iterator2&>()))
template<class Iterator>
constexpr reverse_iterator<Iterator> make_reverse_iterator(Iterator i);
// Returns: reverse_iterator<Iterator>(i).
// 25.5.2 Insert iterators [insert.iterators]
// 25.5.2.1 General [insert.iterators.general]
// To make it possible to deal with insertion in the same way as writing into an array, a special kind of iterator adaptors, called insert iterators, are provided in the library. With regular iterator classes, while (first != last) *result++ = *first++;
// causes a range [first,last) to be copied into a range starting with result. The same code with result being an insert iterator will insert corresponding elements into the container. This device allows all of the copying algorithms in the library to work in the insert mode instead of the regular overwrite mode.
// An insert iterator is constructed from a container and possibly one of its iterators pointing to where insertion takes place if it is neither at the beginning nor at the end of the container. Insert iterators meet the requirements of output iterators. operator* returns the insert iterator itself. The assignment operator=(const T& x) is defined on insert iterators to allow writing into them, it inserts x right before where the insert iterator is pointing. In other words, an insert iterator is like a cursor pointing into the container where the insertion takes place. back_insert_iterator inserts elements at the end of a container, front_insert_iterator inserts elements at the beginning of a container, and insert_iterator inserts elements where the iterator points to in a container. back_inserter, front_inserter, and inserter are three functions making the insert iterators out of a container.
// 25.5.2.2 Class template back_insert_iterator [back.insert.iterator]
namespace std {
template<class Container>
class back_insert_iterator {
protected:
Container* container;
constexpr back_insert_iterator& operator=(const typename Container::value_type& value);
using iterator_category = output_iterator_tag;
using value_type = void;
using difference_type = ptrdiff_t;
using pointer = void;
using reference = void;
using container_type = Container;
constexpr explicit back_insert_iterator(Container& x);
constexpr back_insert_iterator& operator=(const typename Container::value_type& value);
constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
constexpr back_insert_iterator& operator*();
constexpr back_insert_iterator& operator++();
constexpr back_insert_iterator operator++(int);
};
}
// 25.5.2.2.1 Operations
constexpr explicit back_insert_iterator(Container& x);
// Effects: Initializes container with addressof(x).
// Effects: As if by: container->push_back(value); Returns: *this.
constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
// Effects: As if by: container->push_back(std::move(value)); // Returns: *this.
constexpr back_insert_iterator& operator*();
// Returns: *this.
constexpr back_insert_iterator& operator++();
constexpr back_insert_iterator operator++(int);
// Returns: *this.
// 25.5.2.2.2 back_inserter [back.inserter]
template<class Container>
constexpr back_insert_iterator<Container> back_inserter(Container& x);
// Returns: back_insert_iterator<Container>(x).
// 25.5.2.3 Class template front_insert_iterator [front.insert.iterator]
namespace std {
template<class Container>
class front_insert_iterator {
protected:
Container* container;
public:
using iterator_category = output_iterator_tag;
using value_type = void;
using difference_type = ptrdiff_t;
using pointer = void;
using reference = void;
using container_type = Container;
constexpr explicit front_insert_iterator(Container& x);
constexpr front_insert_iterator& operator=(const typename Container::value_type& value);
constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
constexpr front_insert_iterator& operator=(const typename Container::value_type& value);
constexpr insert_iterator(Container& x, ranges::iterator_t<Container> i);
constexpr insert_iterator& operator=(const typename Container::value_type& value);
constexpr insert_iterator& operator=(typename Container::value_type&& value);
constexpr insert_iterator& operator*();
constexpr insert_iterator& operator++();
constexpr insert_iterator& operator++(int);
};
}
// 25.5.2.4.1 Operations [insert.iter.ops]
constexpr insert_iterator(Container& x, ranges::iterator_t<Container> i);
// Effects: Initializes container with addressof(x) and iter with i.
constexpr front_insert_iterator& operator*();
constexpr front_insert_iterator& operator++();
constexpr front_insert_iterator operator++(int);
};
}
// 25.5.2.3.1 Operations [front.insert.iter.ops]
constexpr explicit front_insert_iterator(Container& x);
// Effects: Initializes container with addressof(x).
// Effects: As if by: container->push_front(value); Returns: *this.
constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
// Effects: As if by: container->push_front(std::move(value)); // Returns: *this.
constexpr front_insert_iterator& operator*();
// Returns: *this.
constexpr front_insert_iterator& operator++();
constexpr front_insert_iterator operator++(int);
// Returns: *this.
// 25.5.2.3.2 front_inserter [front.inserter]
template<class Container>
constexpr front_insert_iterator<Container> front_inserter(Container& x);
// Returns: front_insert_iterator<Container>(x).
// 25.5.2.4 Class template insert_iterator [insert.iterator]
namespace std {
template<class Container>
class insert_iterator {
protected:
Container* container;
ranges::iterator_t<Container> iter;
public:
using iterator_category = output_iterator_tag;
using value_type = void;
using difference_type = ptrdiff_t;
using pointer = void;
using reference = void;
using container_type = Container;
constexpr insert_iterator& operator=(const typename
// Container::value_type& value
);
}
// Effects: As if by:
iter = container->insert(iter, value);
++iter;
// Returns: *this.
constexpr insert_iterator& operator=(typename Container::value_type&& value);
// Effects: As if by:
iter = container->insert(iter, std::move(value));
++iter;
// Returns: *this.
constexpr insert_iterator& operator*();
// Returns: *this.
constexpr insert_iterator& operator++();
constexpr insert_iterator& operator++(int);
// Returns: *this.
// 25.5.2.4.2 inserter [inserter]
template<class Container>
constexpr insert_iterator<Container>
inserter(Container& x, ranges::iterator_t<Container> i);
// Returns: insert_iterator<Container>(x, i).
// 25.5.3 Move iterators and sentinels [move.iterators]
// 25.5.3.1 General [move.iterators.general]
// Class template move_iterator is an iterator adaptor with the same behavior as the underlying iterator except that its indirection operator implicitly converts the value returned by the underlying iterator’s indirection operator to an rvalue. Some generic algorithms can be called with move iterators to replace copying with moving.
// [Example 1 :
list<string> s;
// populate the list s
vector<string> v1(s.begin(), s.end()); // copies strings into v1 vector<string> v2(make_move_iterator(s.begin()),
make_move_iterator(s.end())); // moves strings into v2
// 25.5.3.2 Class template move_iterator [move.iterator]
namespace std {
template<class Iterator>
class move_iterator {
public:
using iterator_type = Iterator;
using iterator_concept = input_iterator_tag;
using iterator_category = see_below ;
using value_type = iter_value_t<Iterator>;
using difference_type = iter_difference_t<Iterator>;
using pointer = Iterator;
using reference = iter_rvalue_reference_t<Iterator>;
// not always present
constexpr move_iterator();
constexpr explicit move_iterator(Iterator i);
template<class U> constexpr move_iterator(const move_iterator<U>& u);
template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
// Effects: Initializes current with std::move(i).
constexpr const Iterator& base() const & noexcept;
constexpr Iterator base() &&;
constexpr reference operator*() const;
constexpr move_iterator& operator++();
constexpr auto operator++(int);
constexpr move_iterator& operator--();
constexpr move_iterator operator--(int);
constexpr move_iterator operator+(difference_type n) const;
constexpr move_iterator& operator+=(difference_type n);
constexpr move_iterator operator-(difference_type n) const;
constexpr move_iterator& operator-=(difference_type n);
constexpr reference operator[](difference_type n) const;
template<sentinel_for<Iterator> S>
friend constexpr bool
operator==(const move_iterator& x, const move_sentinel<S>& y);
template<sized_sentinel_for<Iterator> S>
friend constexpr iter_difference_t<Iterator>
operator-(const move_sentinel<S>& x, const move_iterator& y);
template<sized_sentinel_for<Iterator> S>
friend constexpr iter_difference_t<Iterator>
operator-(const move_iterator& x, const move_sentinel<S>& y);
friend constexpr iter_rvalue_reference_t<Iterator>
iter_move(const move_iterator& i)
noexcept(noexcept(ranges::iter_move(i.current)));
template<indirectly_swappable<Iterator> Iterator2>
friend constexpr void
iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y)
noexcept(noexcept(ranges::iter_swap(x.current, y.current)));
private:
Iterator current; // exposition only
};
}
// The member typedef-name iterator_category is defined if and only if the qualified-id iterator_traits<It- erator>::iterator_category is valid and denotes a type. In that case, iterator_category denotes
// — random_access_iterator_tag if the type iterator_traits<Iterator>::iterator_category mod- els derived_from<random_access_iterator_tag>, and
// The template parameter Iterator shall either meet the Cpp17InputIterator requirements (25.3.5.3) or model input_iterator (25.3.4.9). Additionally, if any of the bidirectional traversal functions are instantiated, the template parameter shall either meet the Cpp17BidirectionalIterator requirements (25.3.5.6) or model bidirectional_iterator (25.3.4.12). If any of the random access traversal functions are instantiated, the template parameter shall either meet the Cpp17RandomAccessIterator requirements (25.3.5.7) or model random_access_iterator (25.3.4.13).
// 25.5.3.4 Construction and assignment [move.iter.cons]
constexpr move_iterator();
// Effects: Value-initializes current. constexpr explicit move_iterator(Iterator i);
// — iterator_traits<Iterator>::iterator_category otherwise.
// 25.5.3.3 Requirements [move.iter.requirements]
template<class U> constexpr move_iterator(const move_iterator<U>& u);
// Constraints: is_same_v<U, Iterator> is false and const U& models convertible_to<Iterator>. Effects: Initializes current with u.current.
template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
// Constraints: is_same_v<U, Iterator> is false, const U& models convertible_to<Iterator>, and assignable_from<Iterator&, const U&> is modeled.
// Effects: Assigns u.current to current.
// 25.5.3.5 Conversion [move.iter.op.conv]
constexpr const Iterator& base() const & noexcept;
// Returns: current. constexpr Iterator base() &&;
// Returns: std::move(current).
// 25.5.3.6 Element access [move.iter.elem]
constexpr reference operator*() const;
// Effects: Equivalent to: return ranges::iter_move(current); constexpr reference operator[](difference_type n) const;
// Effects: Equivalent to: return ranges::iter_move(current + n);
// 25.5.3.7 Navigation [move.iter.nav]
constexpr move_iterator& operator++();
// Effects: As if by ++current. Returns: *this.
constexpr auto operator++(int);
// Effects: If Iterator models forward_iterator, equivalent to:
move_iterator tmp = *this;
++current;
return tmp;
// Otherwise, equivalent to ++current.
constexpr move_iterator& operator--();
// Effects: As if by --current. Returns: *this.
constexpr move_iterator operator--(int);
// Effects: As if by:
move_iterator tmp = *this;
--current;
return tmp;
constexpr move_iterator operator+(difference_type n) const;
// Returns: move_iterator(current + n).
constexpr move_iterator& operator+=(difference_type n);
// Effects: As if by: current += n; Returns: *this.
constexpr move_iterator operator-(difference_type n) const;
// Returns: move_iterator(current - n).
constexpr move_iterator& operator-=(difference_type n);
// Effects: As if by: current -= n; Returns: *this.
template<class Iterator1, class Iterator2>
constexpr bool operator<(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
friend constexpr iter_difference_t<Iterator>
operator-(const move_iterator& x, const move_sentinel<S>& y);
// Returns: x.base() - y.base().
// 25.5.3.8 Comparisons [move.iter.op.comp]
template<class Iterator1, class Iterator2>
constexpr bool operator==(const move_iterator<Iterator1>& x,
const move_iterator<Iterator2>& y);
template<sentinel_for<Iterator> S>
friend constexpr bool operator==(const move_iterator& x,
const move_sentinel<S>& y);
// Constraints: x.base() == y.base() is well-formed and convertible to bool. Returns: x.base() == y.base().
// Constraints: x.base() < y.base() is well-formed and convertible to bool. Returns: x.base() < y.base().
template<class Iterator1, class Iterator2>
constexpr bool operator>(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
// Constraints: y.base() < x.base() is well-formed and convertible to bool. Returns: y < x.
template<class Iterator1, class Iterator2>
constexpr bool operator<=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
// Constraints: y.base() < x.base() is well-formed and convertible to bool. Returns: !(y < x).
template<class Iterator1, class Iterator2>
constexpr bool operator>=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
// Constraints: x.base() < y.base() is well-formed and convertible to bool. Returns: !(x < y).
template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
constexpr compare_three_way_result_t<Iterator1, Iterator2>
operator<=>(const move_iterator<Iterator1>& x,
const move_iterator<Iterator2>& y);
// Returns: x.base() <=> y.base().
// 25.5.3.9 Non-member functions [move.iter.nonmember]
template<class Iterator1, class Iterator2>
constexpr auto operator-(
const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y)
-> decltype(x.base() - y.base());
template<sized_sentinel_for<Iterator> S>
friend constexpr iter_difference_t<Iterator>
operator-(const move_sentinel<S>& x, const move_iterator& y);
template<sized_sentinel_for<Iterator> S>
template<class Iterator>
constexpr move_iterator<Iterator>
operator+(iter_difference_t<Iterator> n, const move_iterator<Iterator>& x);
// Constraints: x.base() + n is well-formed and has type Iterator. Returns: x + n.
friend constexpr iter_rvalue_reference_t<Iterator>
iter_move(const move_iterator& i)
noexcept(noexcept(ranges::iter_move(i.current)));
// Effects: Equivalent to: return ranges::iter_move(i.current);
// Effects: Value-initializes last. If is_trivially_default_constructible_v<S> is true, then this constructor is a constexpr constructor.
template<indirectly_swappable<Iterator> Iterator2>
friend constexpr void
iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y)
noexcept(noexcept(ranges::iter_swap(x.current, y.current)));
// Effects: Equivalent to: ranges::iter_swap(x.current, y.current). template<class Iterator>
constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
// Returns: move_iterator<Iterator>(std::move(i)).
// 25.5.3.10 Class template move_sentinel [move.sentinel]
// Class template move_sentinel is a sentinel adaptor useful for denoting ranges together with move_iterator. When an input iterator type I and sentinel type S model sentinel_for<S, I>, move_sentinel<S> and move_iterator<I> model sentinel_for<move_sentinel<S>, move_iterator<I>> as well.
// [Example 1: A move_if algorithm is easily implemented with copy_if using move_iterator and move_sentinel:
template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
indirect_unary_predicate<I> Pred>
requires indirectly_movable<I, O>
void move_if(I first, S last, O out, Pred pred) {
std::ranges::copy_if(move_iterator<I> {first}, move_sentinel<S> {last}, out, pred);
}
namespace std {
template<semiregular S>
class move_sentinel {
public:
constexpr move_sentinel();
constexpr explicit move_sentinel(S s);
template<class S2>
requires convertible_to<const S2&, S>
constexpr move_sentinel(const move_sentinel<S2>& s);
template<class S2>
requires assignable_from<S&, const S2&>
constexpr move_sentinel& operator=(const move_sentinel<S2>& s);
constexpr S base() const;
private:
S last; // exposition only
};
}
// 25.5.3.11 Operations [move.sent.ops]
constexpr move_sentinel();
constexpr explicit move_sentinel(S s);
// Effects: Initializes last with std::move(s).
template<class S2>
requires convertible_to<const S2&, S>
constexpr move_sentinel(const move_sentinel<S2>& s);
// Effects: Initializes last with s.last.
// Effects: Equivalent to: last = s.last; return *this; constexpr S base() const;
template<class S2>
requires assignable_from<S&, const S2&>
constexpr move_sentinel& operator=(const move_sentinel<S2>& s);
// Returns: last.
// 25.5.4 Common iterators [iterators.common]
// 25.5.4.1 Class template common_iterator [common.iterator]
// Class template common_iterator is an iterator/sentinel adaptor that is capable of representing a non-common range of elements (where the types of the iterator and sentinel differ) as a common range (where they are the same). It does this by holding either an iterator or a sentinel, and implementing the equality comparison operators appropriately.
// [Note 1: The common_iterator type is useful for interfacing with legacy code that expects the begin and end of a range to have the same type.
// [Example 1 :
template<class ForwardIterator>
void fun(ForwardIterator begin, ForwardIterator end);
list<int> s;
// populate the list s
using CI = common_iterator<counted_iterator<list<int>::iterator>, default_sentinel_t>; // call fun on a range of 10 ints
fun(CI(counted_iterator(s.begin(), 10)), CI(default_sentinel));
namespace std {
template<input_or_output_iterator I, sentinel_for<I> S>
requires (!same_as<I, S> && copyable<I>)
class common_iterator {
public:
constexpr common_iterator() requires default_initializable<I> = default;
constexpr common_iterator(I i);
constexpr common_iterator(S s);
template<class I2, class S2>
requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
constexpr common_iterator(const common_iterator<I2, S2>& x);
template<class I2, class S2>
requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
constexpr common_iterator& operator=(const common_iterator<I2, S2>& x);
constexpr decltype(auto) operator*();
constexpr decltype(auto) operator*() const
requires dereferenceable<const I>;
constexpr decltype(auto) operator->() const
requires see_below;
constexpr common_iterator& operator++();
constexpr decltype(auto) operator++(int);
template<class I2, sentinel_for<I> S2>
requires sentinel_for<S, I2>
friend constexpr bool operator==(
const common_iterator& x, const common_iterator<I2, S2>& y);
template<class I2, sentinel_for<I> S2>
requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
friend constexpr bool operator==(
const common_iterator& x, const common_iterator<I2, S2>& y);
//- iterator_concept denotes forward_iterator_tag if I models forward_iterator; otherwise it de- notes input_iterator_tag.
//-iterator_category denotes forward_iterator_tag if the qualified-id iterator_traits<I>::iter- ator_category is valid and denotes a type that models derived_from<forward_iterator_tag>; otherwise it denotes input_iterator_tag.
//- Let a denote an lvalue of type const common_iterator<I, S>. If the expression a.operator->() is well-formed, then pointer denotes decltype(a.operator->()). Otherwise, pointer denotes void.
template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
requires sized_sentinel_for<S, I2>
friend constexpr iter_difference_t<I2> operator-(
const common_iterator& x, const common_iterator<I2, S2>& y);
friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
requires input_iterator<I>;
template<indirectly_swappable<I> I2, class S2>
friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
private:
variant<I, S> v_; // exposition only
};
template<class I, class S>
struct incrementable_traits<common_iterator<I, S>> {
using difference_type = iter_difference_t<I>;
};
template<input_iterator I, class S>
struct iterator_traits<common_iterator<I, S>> {
using iterator_concept = see_below;
using iterator_category = see_below;
using value_type = iter_value_t<I>;
using difference_type = iter_difference_t<I>;
using pointer = see_below;
using reference = iter_reference_t<I>;
};
}
// 25.5.4.2 Associated types [common.iter.types]
// The nested typedef-names of the specialization of iterator_traits for common_iterator<I, S> are defined as follows.
// 25.5.4.3 Constructors and conversions [common.iter.const]
constexpr common_iterator(I i);
// Effects: Initializes v_ as if by v_{in_place_type<I>, std::move(i)}. constexpr common_iterator(S s);
// Effects: Initializes v_ as if by v_{in_place_type<S>, std::move(s)}.
template<class I2, class S2>
requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
constexpr common_iterator(const common_iterator<I2, S2>& x);
// Preconditions: x.v_.valueless_by_exception() is false.
// Effects: Initializes v_ as if by v_{in_place_index<i>, get<i>(x.v_)}, where i is x.v_.index().
template<class I2, class S2>
requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
constexpr common_iterator& operator=(const common_iterator<I2, S2>& x);
// Preconditions: x.v_.valueless_by_exception() is false.
// Effects: Equivalent to:
// - If v_.index() == x.v_.index(), then get<i>(v_) = get<i>(x.v_).
// - Otherwise, v_.emplace<i>(get<i>(x.v_)). where i is x.v_.index().
// Returns: *this
// 25.5.4.4 Accessors [common.iter.access]
constexpr decltype(auto) operator*();
constexpr decltype(auto) operator*() const
// Preconditions: holds_alternative<I>(v_) is true. Effects: // Equivalent to ++get<I>(v_).
// Returns: *this.
requires dereferenceable<const I>;
// Preconditions: holds_alternative<I>(v_) is true.
// Effects: Equivalent to: return *get<I>(v_);
constexpr decltype(auto) operator->() const requires see_below;
// The expression in the requires-clause is equivalent to:
indirectly_readable<const I> &&
(requires(const I& i) {
i.operator->();
} ||
is_reference_v<iter_reference_t<I>> ||
constructible_from<iter_value_t<I>, iter_reference_t<I>>)
// Preconditions: holds_alternative<I>(v_) is true. Effects:
// — If I is a pointer type or if the expression get<I>(v_).operator->() is well-formed, equivalent to: return get<I>(v_);
// — Otherwise, if iter_reference_t<I> is a reference type, equivalent to: auto&& tmp = *get<I>(v_);
return addressof(tmp);
// — Otherwise, equivalent to: return proxy(*get<I>(v_)); where proxy is the exposition-only class:
class proxy {
iter_value_t<I> keep_;
constexpr proxy(iter_reference_t<I>&& x)
: keep_(std::move(x)) {}
public:
constexpr const iter_value_t<I>* operator->() const noexcept {
return addressof(keep_);
}
};
// 25.5.4.5 Navigation [common.iter.nav]
constexpr common_iterator& operator++();
constexpr decltype(auto) operator++(int);
// Preconditions: holds_alternative<I>(v_) is true. Effects: If I models forward_iterator, equivalent to:
// Preconditions: x.v_.valueless_by_exception() and y.v_.valueless_by_exception() are each false.
// Returns: true if i == j, and otherwise get<i>(x.v_) == get<j>(y.v_), where i is x.v_.index() and j is y.v_.index().
common_iterator tmp = *this;
++*this;
return tmp;
// Otherwise, if requires(I& i) { { *i++ } -> can-reference; } is true or indirectly_readable<I> && constructible_from<iter_value_t<I>, iter_reference_t<I>> &&
move_constructible<iter_value_t<I>>
// is false, equivalent to: return get<I>(v_)++;
// Otherwise, equivalent to:
postfix-proxy p(**this);
++*this;
return p;
// where postfix-proxy is the exposition-only class:
class postfix-proxy {
iter_value_t<I> keep_;
constexpr postfix-proxy(iter_reference_t<I>&& x)
: keep_(std::forward<iter_reference_t<I>>(x)) {}
public:
constexpr const iter_value_t<I>& operator*() const noexcept {
return keep_;
}
};
// 25.5.4.6 Comparisons [common.iter.cmp]
template<class I2, sentinel_for<I> S2>
requires sentinel_for<S, I2>
friend constexpr bool operator==(
const common_iterator& x, const common_iterator<I2, S2>& y);
template<class I2, sentinel_for<I> S2>
requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
friend constexpr bool operator==(
const common_iterator& x, const common_iterator<I2, S2>& y);
// Preconditions: x.v_.valueless_by_exception() and y.v_.valueless_by_exception() are each false.
// Returns: true if i and j are each 1, and otherwise get<i>(x.v_) == get<j>(y.v_), where i is x.v_.index() and j is y.v_.index().
template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
requires sized_sentinel_for<S, I2>
friend constexpr iter_difference_t<I2> operator-(
const common_iterator& x, const common_iterator<I2, S2>& y);
// Preconditions: x.v_.valueless_by_exception() and y.v_.valueless_by_exception() are each false.
// Returns: 0 if i and j are each 1, and otherwise get<i>(x.v_) - get<j>(y.v_), where i is x.v_.index() and j is y.v_.index().
// 25.5.4.7 Customizations [common.iter.cust]
friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
noexcept(noexcept(ranges::iter_move(declval<const I&>())))
requires input_iterator<I>;
// Preconditions: holds_alternative<I>(i.v_) is true.
// Effects: Equivalent to: return ranges::iter_move(get<I>(i.v_));
template<indirectly_swappable<I> I2, class S2>
friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
}
noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
// Preconditions: holds_alternative<I>(x.v_) and holds_alternative<I2>(y.v_) are each true. Effects: Equivalent to ranges::iter_swap(get<I>(x.v_), get<I2>(y.v_)).
// 25.5.5 Default sentinel [default.sentinel]
namespace std {
struct default_sentinel_t { };
}
// Class default_sentinel_t is an empty type used to denote the end of a range. It can be used together with iterator types that know the bound of their range (e.g., counted_iterator (25.5.6.1)).
// 25.5.6 Counted iterators [iterators.counted]
// 25.5.6.1 Class template counted_iterator [counted.iterator]
// Class template counted_iterator is an iterator adaptor with the same behavior as the underlying iterator except that it keeps track of the distance to the end of its range. It can be used together with default_- sentinel in calls to generic algorithms to operate on a range of N elements starting at a given position without needing to know the end position a priori.
// [Example 1 :
list<string> s;
// populate the list s with at least 10 strings
vector<string> v;
// copies 10 strings into v:
ranges::copy(counted_iterator(s.begin(), 10), default_sentinel, back_inserter(v));
// Two values i1 and i2 of types counted_iterator<I1> and counted_iterator<I2> refer to elements of the same sequence if and only if there exists some integer n such that next(i1.base(), i1.count() + n) and next(i2.base(), i2.count() + n) refer to the same (possibly past-the-end) element.
namespace std {
template<input_or_output_iterator I>
class counted_iterator {
public:
using iterator_type = I;
using value_type = iter_value_t<I>;
// if I models indirectly_readable using difference_type = iter_difference_t<I>;
using iterator_concept = typename I::iterator_concept;
// if the qualified-id I::iterator_concept is valid and denotes a type
using iterator_category = typename I::iterator_category; // present only
// if the qualified-id I::iterator_category is valid and denotes a type
constexpr counted_iterator() requires default_initializable<I> = default;
constexpr counted_iterator(I x, iter_difference_t<I> n);
template<class I2>
requires convertible_to<const I2&, I>
constexpr counted_iterator(const counted_iterator<I2>& x);
template<class I2>
requires assignable_from<I&, const I2&>
constexpr counted_iterator& operator=(const counted_iterator<I2>& x);
constexpr const I& base() const & noexcept;
constexpr I base() &&;
constexpr iter_difference_t<I> count() const noexcept;
constexpr decltype(auto) operator*();
constexpr decltype(auto) operator*() const
requires dereferenceable<const I>;
// present only
// present only
constexpr auto operator->() const noexcept
requires contiguous_iterator<I>;
constexpr counted_iterator& operator++();
constexpr decltype(auto) operator++(int);
constexpr counted_iterator operator++(int)
requires forward_iterator<I>;
constexpr counted_iterator& operator--()
requires bidirectional_iterator<I>;
constexpr counted_iterator operator--(int)
requires bidirectional_iterator<I>;
constexpr counted_iterator operator+(iter_difference_t<I> n) const
requires random_access_iterator<I>;
friend constexpr counted_iterator operator+(
iter_difference_t<I> n, const counted_iterator& x)
requires random_access_iterator<I>;
constexpr counted_iterator& operator+=(iter_difference_t<I> n)
requires random_access_iterator<I>;
constexpr counted_iterator operator-(iter_difference_t<I> n) const
requires random_access_iterator<I>;
template<common_with<I> I2>
friend constexpr iter_difference_t<I2> operator-(
const counted_iterator& x, const counted_iterator<I2>& y);
friend constexpr iter_difference_t<I> operator-(
const counted_iterator& x, default_sentinel_t);
friend constexpr iter_difference_t<I> operator-(
default_sentinel_t, const counted_iterator& y);
constexpr counted_iterator& operator-=(iter_difference_t<I> n)
requires random_access_iterator<I>;
constexpr decltype(auto) operator[](iter_difference_t<I> n) const
requires random_access_iterator<I>;
template<common_with<I> I2>
friend constexpr bool operator==(
const counted_iterator& x, const counted_iterator<I2>& y);
friend constexpr bool operator==(
const counted_iterator& x, default_sentinel_t);
template<common_with<I> I2>
friend constexpr strong_ordering operator<=>(
const counted_iterator& x, const counted_iterator<I2>& y);
friend constexpr iter_rvalue_reference_t<I> iter_move(const counted_iterator& i)
noexcept(noexcept(ranges::iter_move(i.current)))
requires input_iterator<I>;
template<indirectly_swappable<I> I2>
friend constexpr void iter_swap(const counted_iterator& x, const counted_iterator<I2>& y)
noexcept(noexcept(ranges::iter_swap(x.current, y.current)));
private:
I current = I(); // exposition only
iter_difference_t<I> length = 0; // exposition only
};
template<input_iterator I>
requires same_as<ITER_TRAITS (I), iterator_traits<I>>
// see 25.3.4.1 struct iterator_traits<counted_iterator<I>> : iterator_traits<I> {
using pointer = conditional_t<contiguous_iterator<I>,
add_pointer_t<iter_reference_t<I>>, void>;
};
}
// 25.5.6.2 Constructors and conversions [counted.iter.const]
constexpr counted_iterator(I i, iter_difference_t<I> n);
// Preconditions: n >= 0.
// Effects: Initializes current with std::move(i) and length with n.
template<class I2>
requires convertible_to<const I2&, I>
constexpr counted_iterator(const counted_iterator<I2>& x);
// Effects: Initializes current with x.current and length with x.length.
template<class I2>
requires assignable_from<I&, const I2&>
constexpr counted_iterator& operator=(const counted_iterator<I2>& x);
// Effects: Assigns x.current to current and x.length to length. // Returns: *this.
// 25.5.6.3 Accessors [counted.iter.access]
constexpr const I& base() const & noexcept;
// Effects: Equivalent to: return current; constexpr I base() &&;
// Returns: std::move(current).
constexpr iter_difference_t<I> count() const noexcept;
// Effects: Equivalent to: return length;
// 25.5.6.4 Element access [counted.iter.elem]
constexpr decltype(auto) operator*();
constexpr decltype(auto) operator*() const
requires dereferenceable<const I>;
Preconditions:
length > 0 is true. Effects:
Equivalent to:
return *current;
constexpr auto operator->() const noexcept
requires contiguous_iterator<I>;
// Effects: Equivalent to: return to_address(current); constexpr decltype(auto) operator[](iter_difference_t<I> n) const
requires random_access_iterator<I>;
// Preconditions: n < length.
// Effects: Equivalent to: return current[n];
// 25.5.6.5 Navigation [counted.iter.nav]
constexpr counted_iterator& operator++();
// Preconditions: length > 0. Effects: Equivalent to:
++current;
--length;
return *this;
constexpr decltype(auto) operator++(int);
// Preconditions: length > 0. Effects: Equivalent to:
--length;
try {
return current++;
}
catch(...) {
++length;
throw;
}
constexpr counted_iterator operator++(int)
requires forward_iterator<I>;
// Effects: Equivalent to:
counted_iterator tmp = *this;
++*this;
return tmp;
constexpr counted_iterator& operator--()
requires bidirectional_iterator<I>;
// Effects: Equivalent to:
--current;
++length;
return *this;
constexpr counted_iterator operator--(int)
requires bidirectional_iterator<I>;
// Effects: Equivalent to:
counted_iterator tmp = *this;
--*this;
return tmp;
constexpr counted_iterator operator+(iter_difference_t<I> n) const
requires random_access_iterator<I>;
// Effects: Equivalent to: return counted_iterator(current + n, length - n);
friend constexpr counted_iterator operator+(
iter_difference_t<I> n, const counted_iterator& x)
requires random_access_iterator<I>;
// Effects: Equivalent to: return x + n;
constexpr counted_iterator& operator+=(iter_difference_t<I> n)
requires random_access_iterator<I>;
// Preconditions: n <= length. Effects: Equivalent to:
current += n;
length -= n;
return *this;
constexpr counted_iterator operator-(iter_difference_t<I> n) const
requires random_access_iterator<I>;
// Effects: Equivalent to: return counted_iterator(current - n, length + n);
template<common_with<I> I2>
friend constexpr iter_difference_t<I2> operator-(
const counted_iterator& x, const counted_iterator<I2>& y);
// Preconditions: x and y refer to elements of the same sequence (25.5.6.1). Effects: Equivalent to: return y.length - x.length;
friend constexpr iter_difference_t<I> operator-(
const counted_iterator& x, default_sentinel_t);
// Effects: Equivalent to: return -x.length; friend constexpr iter_difference_t<I> operator-(
default_sentinel_t, const counted_iterator& y);
// Effects: Equivalent to: return y.length;
constexpr counted_iterator& operator-=(iter_difference_t<I> n)
requires random_access_iterator<I>;
// Preconditions: -n <= length. Effects: Equivalent to:
current -= n;
length += n;
return *this;
// 25.5.6.6 Comparisons [counted.iter.cmp]
template<common_with<I> I2>
friend constexpr bool operator==(
const counted_iterator& x, const counted_iterator<I2>& y);
// Preconditions: x and y refer to elements of the same sequence (25.5.6.1). Effects: Equivalent to: return x.length == y.length;
friend constexpr bool operator==(
const counted_iterator& x, default_sentinel_t);
// Effects: Equivalent to: return x.length == 0;
template<common_with<I> I2>
friend constexpr strong_ordering operator<=>(
const counted_iterator& x, const counted_iterator<I2>& y);
// Preconditions: x and y refer to elements of the same sequence (25.5.6.1). Effects: Equivalent to: return y.length <=> x.length;
// [Note 1: The argument order in the Effects: element is reversed because length counts down, not up.
// 25.5.6.7 Customizations [counted.iter.cust]
friend constexpr iter_rvalue_reference_t<I>
iter_move(const counted_iterator& i)
noexcept(noexcept(ranges::iter_move(i.current)))
requires input_iterator<I>;
// Preconditions: i.length > 0 is true.
// Effects: Equivalent to: return ranges::iter_move(i.current);
template<indirectly_swappable<I> I2>
friend constexpr void
iter_swap(const counted_iterator& x, const counted_iterator<I2>& y)
noexcept(noexcept(ranges::iter_swap(x.current, y.current)));
// Preconditions: Both x.length > 0 and y.length > 0 are true. // Effects: Equivalent to ranges::iter_swap(x.current, y.current).
// 25.5.7 Unreachable sentinel [unreachable.sentinel]
// Class unreachable_sentinel_t can be used with any weakly_incrementable type to denote the “upper bound” of an unbounded interval.
// [Example 1 :
char* p;
// set p to point to a character buffer containing newlines char* nl = find(p, unreachable_sentinel, '\n');
// Provided a newline character really exists in the buffer, the use of unreachable_sentinel above potentially makes the call to find more efficient since the loop test against the sentinel does not require a conditional branch.
namespace std {
struct unreachable_sentinel_t {
template<weakly_incrementable I>
friend constexpr bool operator==(unreachable_sentinel_t, const I&) noexcept
{
return false;
}
};
}
int main() {
cout << n4910 << endl;
return EXIT_SUCCESS;
}
編纂・実行結果(compile and go)
$ clang++ p998.cpp -std=03 -o p998l -I. -Wall
In file included from p998.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 \
^
p998.cpp:20:9: error: redefinition of 'reverse_iterator'
class reverse_iterator {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:125:11: note: previous definition is here
class reverse_iterator
^
p998.cpp:62:1: error: unknown type name 'constexpr'
constexpr reverse_iterator();
^
p998.cpp:64:1: error: unknown type name 'constexpr'
constexpr explicit reverse_iterator(Iterator x);
^
p998.cpp:64:37: error: unknown type name 'Iterator'
constexpr explicit reverse_iterator(Iterator x);
^
p998.cpp:66:19: error: unknown type name 'constexpr'
template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
^
p998.cpp:69:3: error: unknown type name 'constexpr'
constexpr reverse_iterator&
^
p998.cpp:69:13: warning: variable templates are a C++14 extension [-Wc++14-extensions]
constexpr reverse_iterator&
^
p998.cpp:69:29: error: expected ';' at end of declaration
constexpr reverse_iterator&
^
;
p998.cpp:70:34: error: use of undeclared identifier 'U'
operator=(const reverse_iterator<U>& u);
^
p998.cpp:70:1: error: C++ requires a type specifier for all declarations
operator=(const reverse_iterator<U>& u);
^
p998.cpp:74:1: error: unknown type name 'Iterator'
Iterator tmp = current;
^
p998.cpp:74:16: error: use of undeclared identifier 'current'
Iterator tmp = current;
^
p998.cpp:75:3: error: expected unqualified-id
return *--tmp;
^
p998.cpp:77:1: error: unknown type name 'constexpr'
constexpr Iterator base() const;
^
p998.cpp:77:19: error: expected ';' after top level declarator
constexpr Iterator base() const;
^
;
p998.cpp:80:1: error: unknown type name 'constexpr'
constexpr reference operator*() const;
^
p998.cpp:80:20: error: expected ';' after top level declarator
constexpr reference operator*() const;
^
;
p998.cpp:82:1: error: unknown type name 'constexpr'
constexpr pointer operator->() const
^
p998.cpp:82:18: error: expected ';' after top level declarator
constexpr pointer operator->() const
^
;
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
$ clang++ p998.cpp -std=2b -o p998l -I. -Wall
p998.cpp:20:9: error: redefinition of 'reverse_iterator'
class reverse_iterator {
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:125:11: note: previous definition is here
class reverse_iterator
^
p998.cpp:62:11: error: deduction guide must be declared in the same scope as template 'std::reverse_iterator'
constexpr reverse_iterator();
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:125:11: note: template is declared here
class reverse_iterator
^
p998.cpp:62:11: error: deduction guide cannot be declared 'constexpr'
constexpr reverse_iterator();
~~~~~~~~~ ^
p998.cpp:62:11: error: deduction guide declaration without trailing return type
p998.cpp:64:37: error: unknown type name 'Iterator'
constexpr explicit reverse_iterator(Iterator x);
^
p998.cpp:64:20: error: deduction guide must be declared in the same scope as template 'std::reverse_iterator'
constexpr explicit reverse_iterator(Iterator x);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:125:11: note: template is declared here
class reverse_iterator
^
p998.cpp:64:20: error: deduction guide cannot be declared 'constexpr'
constexpr explicit reverse_iterator(Iterator x);
~~~~~~~~~ ^
p998.cpp:64:20: error: deduction guide declaration without trailing return type
p998.cpp:66:29: error: deduction guide must be declared in the same scope as template 'std::reverse_iterator'
template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
^
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:125:11: note: template is declared here
class reverse_iterator
^
p998.cpp:66:29: error: deduction guide cannot be declared 'constexpr'
template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
~~~~~~~~~ ^
p998.cpp:66:29: error: deduction guide declaration without trailing return type
p998.cpp:69:13: error: use of class template 'reverse_iterator' requires template arguments; argument deduction not allowed in function return type
constexpr reverse_iterator&
^~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/stl_iterator.h:125:11: note: template is declared here
class reverse_iterator
^
p998.cpp:74:1: error: unknown type name 'Iterator'
Iterator tmp = current;
^
p998.cpp:74:16: error: use of undeclared identifier 'current'; did you mean 'crend'?
Iterator tmp = current;
^~~~~~~
crend
/usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/range_access.h:231:5: note: 'crend' declared here
crend(const _Container& __cont) -> decltype(std::rend(__cont))
^
p998.cpp:75:3: error: expected unqualified-id
return *--tmp;
^
p998.cpp:77:11: error: unknown type name 'Iterator'
constexpr Iterator base() const;
^
p998.cpp:77:27: error: non-member function cannot have 'const' qualifier
constexpr Iterator base() const;
^~~~~
p998.cpp:80:11: error: unknown type name 'reference'
constexpr reference operator*() const;
^
p998.cpp:80:33: error: non-member function cannot have 'const' qualifier
constexpr reference operator*() const;
^~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
$ g++ p998.cpp -std=03 -o p998g -I. -Wall
In file included from /usr/local/include/c++/12.1.0/atomic:38,
from N4910.h:11,
from p998.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 \
| ^~~~~
p998.cpp:29:1: warning: identifier 'constexpr' is a keyword in C++11 [-Wc++11-compat]
29 | constexpr reverse_iterator();
| ^~~~~~~~~
p998.cpp:42:89: warning: identifier 'noexcept' is a keyword in C++11 [-Wc++11-compat]
42 | friend constexpr iter_rvalue_reference_t<Iterator> iter_move(const reverse_iterator& i) noexcept(see_below);
| ^~~~~~~~
p998.cpp:151:46: warning: identifier 'decltype' is a keyword in C++11 [-Wc++11-compat]
151 | const reverse_iterator<Iterator2>& y) -> decltype(y.base() - x.base());
| ^~~~~~~~
p998.cpp:20:9: error: redefinition of 'class std::reverse_iterator<_Iterator>'
20 | class reverse_iterator {
| ^~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/string:47,
from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/12.1.0/ios:42,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from N4910.h:2:
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: previous definition of 'class std::reverse_iterator<_Iterator>'
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:62:1: error: 'constexpr' does not name a type
62 | constexpr reverse_iterator();
| ^~~~~~~~~
p998.cpp:62:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:64:1: error: 'constexpr' does not name a type
64 | constexpr explicit reverse_iterator(Iterator x);
| ^~~~~~~~~
p998.cpp:64:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:66:19: error: 'constexpr' does not name a type
66 | template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:66:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:69:3: error: 'constexpr' does not name a type
69 | constexpr reverse_iterator&
| ^~~~~~~~~
p998.cpp:69:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:74:1: error: 'Iterator' does not name a type
74 | Iterator tmp = current;
| ^~~~~~~~
p998.cpp:75:3: error: expected unqualified-id before 'return'
75 | return *--tmp;
| ^~~~~~
p998.cpp:77:1: error: 'constexpr' does not name a type
77 | constexpr Iterator base() const;
| ^~~~~~~~~
p998.cpp:77:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:80:1: error: 'constexpr' does not name a type
80 | constexpr reference operator*() const;
| ^~~~~~~~~
p998.cpp:80:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:82:1: error: 'constexpr' does not name a type
82 | constexpr pointer operator->() const
| ^~~~~~~~~
p998.cpp:82:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:84:54: error: expected unqualified-id before ')' token
84 | requires(const Iterator i) { i.operator->(); });
| ^
p998.cpp:86:1: error: 'constexpr' does not name a type
86 | constexpr unspecified operator[](difference_type n) const; // Returns: current[-n-1].
| ^~~~~~~~~
p998.cpp:86:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:88:1: error: 'constexpr' does not name a type
88 | constexpr reverse_iterator operator+(difference_type n) const;
| ^~~~~~~~~
p998.cpp:88:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:90:1: error: 'constexpr' does not name a type
90 | constexpr reverse_iterator operator-(difference_type n) const;
| ^~~~~~~~~
p998.cpp:90:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:92:1: error: 'constexpr' does not name a type
92 | constexpr reverse_iterator& operator++();
| ^~~~~~~~~
p998.cpp:92:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:94:1: error: 'constexpr' does not name a type
94 | constexpr reverse_iterator operator++(int);
| ^~~~~~~~~
p998.cpp:94:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:96:3: error: invalid use of template-name 'std::reverse_iterator' without an argument list
96 | reverse_iterator tmp = *this;
| ^~~~~~~~~~~~~~~~
p998.cpp:96:3: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:97:3: error: expected unqualified-id before '--' token
97 | --current;
| ^~
p998.cpp:98:3: error: expected unqualified-id before 'return'
98 | return tmp;
| ^~~~~~
p998.cpp:99:1: error: 'constexpr' does not name a type
99 | constexpr reverse_iterator& operator--();
| ^~~~~~~~~
p998.cpp:99:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:101:1: error: 'constexpr' does not name a type
101 | constexpr reverse_iterator operator--(int);
| ^~~~~~~~~
p998.cpp:101:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:103:3: error: invalid use of template-name 'std::reverse_iterator' without an argument list
103 | reverse_iterator tmp = *this;
| ^~~~~~~~~~~~~~~~
p998.cpp:103:3: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++1'
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:104:3: error: expected unqualified-id before '++' token
104 | ++current;
| ^~
p998.cpp:105:3: error: expected unqualified-id before 'return'
105 | return tmp;
| ^~~~~~
p998.cpp:106:1: error: 'constexpr' does not name a type
106 | constexpr reverse_iterator& operator+=(difference_type n);
| ^~~~~~~~~
p998.cpp:106:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:108:1: error: 'constexpr' does not name a type
108 | constexpr reverse_iterator& operator-=(difference_type n);
| ^~~~~~~~~
p998.cpp:108:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:111:3: error: 'constexpr' does not name a type
111 | constexpr bool operator!=(
| ^~~~~~~~~
p998.cpp:111:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:118:24: error: 'Iterator1' was not declared in this scope
118 | const reverse_iterator<Iterator1>& x,
| ^~~~~~~~~
p998.cpp:118:33: error: template argument 1 is invalid
118 | const reverse_iterator<Iterator1>& x,
| ^
p998.cpp:118:36: error: 'x' declared as reference but not initialized
118 | const reverse_iterator<Iterator1>& x,
| ^
p998.cpp:119:1: error: expected unqualified-id before 'const'
119 | const reverse_iterator<Iterator2>& y);
| ^~~~~
p998.cpp:122:3: error: 'constexpr' does not name a type
122 | constexpr bool operator<(
| ^~~~~~~~~
p998.cpp:122:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:127:3: error: 'constexpr' does not name a type
127 | constexpr bool operator>(
| ^~~~~~~~~
p998.cpp:127:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:132:3: error: 'constexpr' does not name a type
132 | constexpr bool operator<=(
| ^~~~~~~~~
p998.cpp:132:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:137:3: error: 'constexpr' does not name a type
137 | constexpr bool operator>=(
| ^~~~~~~~~
p998.cpp:137:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:141:27: error: 'three_way_comparable_with' has not been declared
141 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:141:52: error: expected '>' before '<' token
141 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
| ^
p998.cpp:142:3: error: 'constexpr' does not name a type
142 | constexpr compare_three_way_result_t<Iterator1, Iterator2>
| ^~~~~~~~~
p998.cpp:142:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:149:3: error: 'constexpr' does not name a type
149 | constexpr auto operator-(
| ^~~~~~~~~
p998.cpp:149:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:155:3: error: 'constexpr' does not name a type
155 | constexpr reverse_iterator<Iterator> operator+(
| ^~~~~~~~~
p998.cpp:155:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:158:17: error: invalid use of template-name 'std::reverse_iterator' without an argument list
158 | iter_move(const reverse_iterator& i) noexcept(see_below); // Effects: Equivalent to:
| ^~~~~~~~~~~~~~~~
p998.cpp:158:17: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:158:38: error: expected constructor, destructor, or type conversion before 'noexcept'
158 | iter_move(const reverse_iterator& i) noexcept(see_below); // Effects: Equivalent to:
| ^~~~~~~~
p998.cpp:159:6: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
159 | auto tmp = i.base();
| ^~~~
| ----
p998.cpp:159:11: error: 'tmp' does not name a type; did you mean 'tm'?
159 | auto tmp = i.base();
| ^~~
| tm
p998.cpp:160:6: error: expected unqualified-id before 'return'
160 | return ranges::iter_move(--tmp);
| ^~~~~~
p998.cpp:162:14: error: expected constructor, destructor, or type conversion before '(' token
162 | noexcept(ranges::iter_move(--declval<Iterator&>()))
| ^
p998.cpp:168:4: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
168 | auto xtmp = x.base();
| ^~~~
| ----
p998.cpp:168:9: error: 'xtmp' does not name a type; did you mean 'tm'?
168 | auto xtmp = x.base();
| ^~~~
| tm
p998.cpp:169:4: warning: 'auto' changes meaning in C++11; please remove it [-Wc++11-compat]
169 | auto ytmp = y.base();
| ^~~~
| ----
p998.cpp:169:9: error: 'ytmp' does not name a type; did you mean 'tm'?
169 | auto ytmp = y.base();
| ^~~~
| tm
p998.cpp:170:4: error: 'ranges' does not name a type
170 | ranges::iter_swap(--xtmp, --ytmp);
| ^~~~~~
p998.cpp:172:4: error: 'is_nothrow_copy_constructible_v' does not name a type
172 | is_nothrow_copy_constructible_v<Iterator> &&
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:186:14: error: redefinition of 'class std::back_insert_iterator<_Container>'
186 | class back_insert_iterator {
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:694:11: note: previous definition of 'class std::back_insert_iterator<_Container>'
694 | class back_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:204:1: error: 'constexpr' does not name a type
204 | constexpr explicit back_insert_iterator(Container& x);
| ^~~~~~~~~
p998.cpp:204:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:207:1: error: 'constexpr' does not name a type
207 | constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~
p998.cpp:207:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:209:1: error: 'constexpr' does not name a type
209 | constexpr back_insert_iterator& operator*();
| ^~~~~~~~~
p998.cpp:209:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:211:1: error: 'constexpr' does not name a type
211 | constexpr back_insert_iterator& operator++();
| ^~~~~~~~~
p998.cpp:211:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:212:1: error: 'constexpr' does not name a type
212 | constexpr back_insert_iterator operator++(int);
| ^~~~~~~~~
p998.cpp:212:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:216:3: error: 'constexpr' does not name a type
216 | constexpr back_insert_iterator<Container> back_inserter(Container& x);
| ^~~~~~~~~
p998.cpp:216:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:221:11: error: redefinition of 'class std::front_insert_iterator<_Container>'
221 | class front_insert_iterator {
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: previous definition of 'class std::front_insert_iterator<_Container>'
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:243:1: error: 'constexpr' does not name a type
243 | constexpr insert_iterator(Container& x, ranges::iterator_t<Container> i);
| ^~~~~~~~~
p998.cpp:243:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:245:5: error: 'constexpr' does not name a type
245 | constexpr front_insert_iterator& operator*();
| ^~~~~~~~~
p998.cpp:245:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:246:5: error: 'constexpr' does not name a type
246 | constexpr front_insert_iterator& operator++();
| ^~~~~~~~~
p998.cpp:246:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:247:5: error: 'constexpr' does not name a type
247 | constexpr front_insert_iterator operator++(int);
| ^~~~~~~~~
p998.cpp:247:5: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:248:1: error: expected declaration before '}' token
248 | }; }
| ^
p998.cpp:248:4: error: expected declaration before '}' token
248 | }; }
| ^
p998.cpp:250:1: error: 'constexpr' does not name a type
250 | constexpr explicit front_insert_iterator(Container& x);
| ^~~~~~~~~
p998.cpp:250:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:253:1: error: 'constexpr' does not name a type
253 | constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~
p998.cpp:253:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:255:1: error: 'constexpr' does not name a type
255 | constexpr front_insert_iterator& operator*();
| ^~~~~~~~~
p998.cpp:255:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:257:1: error: 'constexpr' does not name a type
257 | constexpr front_insert_iterator& operator++();
| ^~~~~~~~~
p998.cpp:257:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:258:1: error: 'constexpr' does not name a type
258 | constexpr front_insert_iterator operator++(int);
| ^~~~~~~~~
p998.cpp:258:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:262:3: error: 'constexpr' does not name a type
262 | constexpr front_insert_iterator<Container> front_inserter(Container& x);
| ^~~~~~~~~
p998.cpp:262:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:267:11: error: redefinition of 'class std::insert_iterator<_Container>'
267 | class insert_iterator {
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:900:11: note: previous definition of 'class std::insert_iterator<_Container>'
900 | class insert_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:284:1: error: expected unqualified-id before '++' token
284 | ++iter;
| ^~
p998.cpp:286:1: error: 'constexpr' does not name a type
286 | constexpr insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~
p998.cpp:286:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:288:1: error: 'iter' does not name a type
288 | iter = container->insert(iter, std::move(value));
| ^~~~
p998.cpp:289:1: error: expected unqualified-id before '++' token
289 | ++iter;
| ^~
p998.cpp:291:1: error: 'constexpr' does not name a type
291 | constexpr insert_iterator& operator*();
| ^~~~~~~~~
p998.cpp:291:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:293:1: error: 'constexpr' does not name a type
293 | constexpr insert_iterator& operator++();
| ^~~~~~~~~
p998.cpp:293:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:294:1: error: 'constexpr' does not name a type
294 | constexpr insert_iterator& operator++(int);
| ^~~~~~~~~
p998.cpp:294:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:298:3: error: 'constexpr' does not name a type
298 | constexpr insert_iterator<Container>
| ^~~~~~~~~
p998.cpp:298:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:305:1: error: 'list' does not name a type
305 | list<string> s;
| ^~~~
p998.cpp:307:19: error: 's' was not declared in this scope; did you mean 'ws'?
307 | vector<string> v1(s.begin(), s.end()); // copies strings into v1 vector<string> v2(make_move_iterator(s.begin()),
| ^
| ws
p998.cpp:307:30: error: 's' was not declared in this scope; did you mean 'ws'?
307 | vector<string> v1(s.begin(), s.end()); // copies strings into v1 vector<string> v2(make_move_iterator(s.begin()),
| ^
| ws
p998.cpp:308:19: error: expected constructor, destructor, or type conversion before '(' token
308 | make_move_iterator(s.end())); // moves strings into v2
| ^
p998.cpp:314:11: error: expected nested-name-specifier before 'iterator_type'
314 | using iterator_type = Iterator;
| ^~~~~~~~~~~~~
p998.cpp:315:11: error: expected nested-name-specifier before 'iterator_concept'
315 | using iterator_concept = input_iterator_tag;
| ^~~~~~~~~~~~~~~~
p998.cpp:316:7: error: expected nested-name-specifier before 'iterator_category'
316 | using iterator_category = see_below ;
| ^~~~~~~~~~~~~~~~~
p998.cpp:317:7: error: expected nested-name-specifier before 'value_type'
317 | using value_type = iter_value_t<Iterator>;
| ^~~~~~~~~~
p998.cpp:318:7: error: expected nested-name-specifier before 'difference_type'
318 | using difference_type = iter_difference_t<Iterator>;
| ^~~~~~~~~~~~~~~
p998.cpp:319:7: error: expected nested-name-specifier before 'pointer'
319 | using pointer = Iterator;
| ^~~~~~~
p998.cpp:320:7: error: expected nested-name-specifier before 'reference'
320 | using reference = iter_rvalue_reference_t<Iterator>;
| ^~~~~~~~~
p998.cpp:322:1: error: 'constexpr' does not name a type
322 | constexpr move_iterator();
| ^~~~~~~~~
p998.cpp:322:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:323:1: error: 'constexpr' does not name a type
323 | constexpr explicit move_iterator(Iterator i);
| ^~~~~~~~~
p998.cpp:323:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:324:19: error: 'constexpr' does not name a type
324 | template<class U> constexpr move_iterator(const move_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:324:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:325:19: error: 'constexpr' does not name a type
325 | template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:325:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:327:10: error: 'constexpr' does not name a type
327 | constexpr const Iterator& base() const & noexcept;
| ^~~~~~~~~
p998.cpp:327:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:328:10: error: 'constexpr' does not name a type
328 | constexpr Iterator base() &&;
| ^~~~~~~~~
p998.cpp:328:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:329:10: error: 'constexpr' does not name a type
329 | constexpr reference operator*() const;
| ^~~~~~~~~
p998.cpp:329:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:330:10: error: 'constexpr' does not name a type
330 | constexpr move_iterator& operator++();
| ^~~~~~~~~
p998.cpp:330:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:331:10: error: 'constexpr' does not name a type
331 | constexpr auto operator++(int);
| ^~~~~~~~~
p998.cpp:331:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:332:10: error: 'constexpr' does not name a type
332 | constexpr move_iterator& operator--();
| ^~~~~~~~~
p998.cpp:332:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:333:10: error: 'constexpr' does not name a type
333 | constexpr move_iterator operator--(int);
| ^~~~~~~~~
p998.cpp:333:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:334:10: error: 'constexpr' does not name a type
334 | constexpr move_iterator operator+(difference_type n) const;
| ^~~~~~~~~
p998.cpp:334:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:335:10: error: 'constexpr' does not name a type
335 | constexpr move_iterator& operator+=(difference_type n);
| ^~~~~~~~~
p998.cpp:335:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:336:10: error: 'constexpr' does not name a type
336 | constexpr move_iterator operator-(difference_type n) const;
| ^~~~~~~~~
p998.cpp:336:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:337:10: error: 'constexpr' does not name a type
337 | constexpr move_iterator& operator-=(difference_type n);
| ^~~~~~~~~
p998.cpp:337:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:338:10: error: 'constexpr' does not name a type
338 | constexpr reference operator[](difference_type n) const;
| ^~~~~~~~~
p998.cpp:338:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:339:19: error: 'sentinel_for' has not been declared
339 | template<sentinel_for<Iterator> S>
| ^~~~~~~~~~~~
p998.cpp:339:31: error: expected '>' before '<' token
339 | template<sentinel_for<Iterator> S>
| ^
p998.cpp:340:19: error: 'constexpr' does not name a type
340 | friend constexpr bool
| ^~~~~~~~~
p998.cpp:340:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:342:19: error: 'sized_sentinel_for' has not been declared
342 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~
p998.cpp:342:37: error: expected '>' before '<' token
342 | template<sized_sentinel_for<Iterator> S>
| ^
p998.cpp:343:19: error: 'constexpr' does not name a type
343 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~~~~
p998.cpp:343:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:345:19: error: 'sized_sentinel_for' has not been declared
345 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~
p998.cpp:345:37: error: expected '>' before '<' token
345 | template<sized_sentinel_for<Iterator> S>
| ^
p998.cpp:346:19: error: 'constexpr' does not name a type
346 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~~~~
p998.cpp:346:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:348:17: error: 'constexpr' does not name a type
348 | friend constexpr iter_rvalue_reference_t<Iterator>
| ^~~~~~~~~
p998.cpp:348:17: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:351:19: error: 'indirectly_swappable' has not been declared
351 | template<indirectly_swappable<Iterator> Iterator2>
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:351:39: error: expected '>' before '<' token
351 | template<indirectly_swappable<Iterator> Iterator2>
| ^
p998.cpp:352:19: error: 'constexpr' does not name a type
352 | friend constexpr void
| ^~~~~~~~~
p998.cpp:352:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:362:6: error: 'constexpr' does not name a type
362 | constexpr move_iterator();
| ^~~~~~~~~
p998.cpp:362:6: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:366:19: error: 'constexpr' does not name a type
366 | template<class U> constexpr move_iterator(const move_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:366:19: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:368:22: error: 'constexpr' does not name a type
368 | template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:368:22: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:372:1: error: 'constexpr' does not name a type
372 | constexpr const Iterator& base() const & noexcept;
| ^~~~~~~~~
p998.cpp:372:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:376:1: error: 'constexpr' does not name a type
376 | constexpr reference operator*() const;
| ^~~~~~~~~
p998.cpp:376:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:380:1: error: 'constexpr' does not name a type
380 | constexpr move_iterator& operator++();
| ^~~~~~~~~
p998.cpp:380:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:382:1: error: 'constexpr' does not name a type
382 | constexpr auto operator++(int);
| ^~~~~~~~~
p998.cpp:382:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:384:3: error: 'move_iterator' does not name a type; did you mean 'reverse_iterator'?
384 | move_iterator tmp = *this;
| ^~~~~~~~~~~~~
| reverse_iterator
p998.cpp:385:3: error: expected unqualified-id before '++' token
385 | ++current;
| ^~
p998.cpp:386:3: error: expected unqualified-id before 'return'
386 | return tmp;
| ^~~~~~
p998.cpp:388:1: error: 'constexpr' does not name a type
388 | constexpr move_iterator& operator--();
| ^~~~~~~~~
p998.cpp:388:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:390:1: error: 'constexpr' does not name a type
390 | constexpr move_iterator operator--(int);
| ^~~~~~~~~
p998.cpp:390:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:392:3: error: 'move_iterator' does not name a type; did you mean 'reverse_iterator'?
392 | move_iterator tmp = *this;
| ^~~~~~~~~~~~~
| reverse_iterator
p998.cpp:393:3: error: expected unqualified-id before '--' token
393 | --current;
| ^~
p998.cpp:394:3: error: expected unqualified-id before 'return'
394 | return tmp;
| ^~~~~~
p998.cpp:395:1: error: 'constexpr' does not name a type
395 | constexpr move_iterator operator+(difference_type n) const;
| ^~~~~~~~~
p998.cpp:395:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:397:1: error: 'constexpr' does not name a type
397 | constexpr move_iterator& operator+=(difference_type n);
| ^~~~~~~~~
p998.cpp:397:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:399:1: error: 'constexpr' does not name a type
399 | constexpr move_iterator operator-(difference_type n) const;
| ^~~~~~~~~
p998.cpp:399:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:401:1: error: 'constexpr' does not name a type
401 | constexpr move_iterator& operator-=(difference_type n);
| ^~~~~~~~~
p998.cpp:401:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:404:1: error: 'constexpr' does not name a type
404 | constexpr bool operator<(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
| ^~~~~~~~~
p998.cpp:404:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:405:1: error: 'friend' used outside of class
405 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~
| ------
p998.cpp:405:8: error: 'constexpr' does not name a type
405 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~~~~
p998.cpp:405:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:410:3: error: 'constexpr' does not name a type
410 | constexpr bool operator==(const move_iterator<Iterator1>& x,
| ^~~~~~~~~
p998.cpp:410:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:412:10: error: 'sentinel_for' has not been declared
412 | template<sentinel_for<Iterator> S>
| ^~~~~~~~~~~~
p998.cpp:412:22: error: expected '>' before '<' token
412 | template<sentinel_for<Iterator> S>
| ^
p998.cpp:413:3: error: 'friend' used outside of class
413 | friend constexpr bool operator==(const move_iterator& x,
| ^~~~~~
| ------
p998.cpp:413:10: error: 'constexpr' does not name a type
413 | friend constexpr bool operator==(const move_iterator& x,
| ^~~~~~~~~
p998.cpp:413:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:418:1: error: 'constexpr' does not name a type
418 | constexpr bool operator>(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
| ^~~~~~~~~
p998.cpp:418:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:421:1: error: 'constexpr' does not name a type
421 | constexpr bool operator<=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
| ^~~~~~~~~
p998.cpp:421:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:424:1: error: 'constexpr' does not name a type
424 | constexpr bool operator>=(const move_iterator<Iterator1>& x, const move_iterator<Iterator2>& y);
| ^~~~~~~~~
p998.cpp:424:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:426:27: error: 'three_way_comparable_with' has not been declared
426 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:426:52: error: expected '>' before '<' token
426 | template<class Iterator1, three_way_comparable_with<Iterator1> Iterator2>
| ^
p998.cpp:427:3: error: 'constexpr' does not name a type
427 | constexpr compare_three_way_result_t<Iterator1, Iterator2>
| ^~~~~~~~~
p998.cpp:427:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:433:3: error: 'constexpr' does not name a type
433 | constexpr auto operator-(
| ^~~~~~~~~
p998.cpp:433:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:436:10: error: 'sized_sentinel_for' has not been declared
436 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~
p998.cpp:436:28: error: expected '>' before '<' token
436 | template<sized_sentinel_for<Iterator> S>
| ^
p998.cpp:437:3: error: 'friend' used outside of class
437 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~
| ------
p998.cpp:437:10: error: 'constexpr' does not name a type
437 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~~~~
p998.cpp:437:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:439:10: error: 'sized_sentinel_for' has not been declared
439 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~
p998.cpp:439:28: error: expected '>' before '<' token
439 | template<sized_sentinel_for<Iterator> S>
| ^
p998.cpp:441:3: error: 'constexpr' does not name a type
441 | constexpr move_iterator<Iterator>
| ^~~~~~~~~
p998.cpp:441:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:444:1: error: 'friend' used outside of class
444 | friend constexpr iter_rvalue_reference_t<Iterator>
| ^~~~~~
| ------
p998.cpp:444:8: error: 'constexpr' does not name a type
444 | friend constexpr iter_rvalue_reference_t<Iterator>
| ^~~~~~~~~
p998.cpp:444:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:449:10: error: 'indirectly_swappable' has not been declared
449 | template<indirectly_swappable<Iterator> Iterator2>
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:449:30: error: expected '>' before '<' token
449 | template<indirectly_swappable<Iterator> Iterator2>
| ^
p998.cpp:450:3: error: 'friend' used outside of class
450 | friend constexpr void
| ^~~~~~
| ------
p998.cpp:450:10: error: 'constexpr' does not name a type
450 | friend constexpr void
| ^~~~~~~~~
p998.cpp:450:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:454:1: error: 'constexpr' does not name a type
454 | constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
| ^~~~~~~~~
p998.cpp:454:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:459:15: error: 'input_iterator' has not been declared
459 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
| ^~~~~~~~~~~~~~
p998.cpp:459:33: error: 'sentinel_for' has not been declared
459 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
| ^~~~~~~~~~~~
p998.cpp:459:45: error: expected '>' before '<' token
459 | template<input_iterator I, sentinel_for<I> S, weakly_incrementable O,
| ^
p998.cpp:461:8: error: 'requires' does not name a type
461 | requires indirectly_movable<I, O>
| ^~~~~~~~
p998.cpp:461:8: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:466:14: error: 'semiregular' has not been declared
466 | template<semiregular S>
| ^~~~~~~~~~~
p998.cpp:469:7: error: 'constexpr' does not name a type
469 | constexpr move_sentinel();
| ^~~~~~~~~
p998.cpp:469:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:470:7: error: 'constexpr' does not name a type
470 | constexpr explicit move_sentinel(S s);
| ^~~~~~~~~
p998.cpp:470:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:472:9: error: 'requires' does not name a type
472 | requires convertible_to<const S2&, S>
| ^~~~~~~~
p998.cpp:472:9: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:475:9: error: 'requires' does not name a type
475 | requires assignable_from<S&, const S2&>
| ^~~~~~~~
p998.cpp:475:9: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:477:7: error: 'constexpr' does not name a type
477 | constexpr S base() const;
| ^~~~~~~~~
p998.cpp:477:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:479:1: error: 'S' does not name a type
479 | S last; // exposition only
| ^
p998.cpp:483:1: error: 'constexpr' does not name a type
483 | constexpr move_sentinel();
| ^~~~~~~~~
p998.cpp:483:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:484:1: error: 'constexpr' does not name a type
484 | constexpr explicit move_sentinel(S s);
| ^~~~~~~~~
p998.cpp:484:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:487:3: error: 'requires' does not name a type
487 | requires convertible_to<const S2&, S>
| ^~~~~~~~
p998.cpp:487:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:492:3: error: 'requires' does not name a type
492 | requires assignable_from<S&, const S2&>
| ^~~~~~~~
p998.cpp:492:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:502:1: error: 'list' does not name a type
502 | list<int> s;
| ^~~~
p998.cpp:504:7: error: expected nested-name-specifier before 'CI'
504 | using CI = common_iterator<counted_iterator<list<int>::iterator>, default_sentinel_t>; // call fun on a range of 10 ints
| ^~
p998.cpp:505:4: error: expected constructor, destructor, or type conversion before '(' token
505 | fun(CI(counted_iterator(s.begin(), 10)), CI(default_sentinel));
| ^
p998.cpp:507:17: error: 'input_or_output_iterator' has not been declared
507 | template<input_or_output_iterator I, sentinel_for<I> S>
| ^~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:507:45: error: 'sentinel_for' has not been declared
507 | template<input_or_output_iterator I, sentinel_for<I> S>
| ^~~~~~~~~~~~
p998.cpp:507:57: error: expected '>' before '<' token
507 | template<input_or_output_iterator I, sentinel_for<I> S>
| ^
p998.cpp:508:19: error: expected constructor, destructor, or type conversion before '(' token
508 | requires (!same_as<I, S> && copyable<I>)
| ^
p998.cpp:552:15: error: 'incrementable_traits' is not a class template
552 | struct incrementable_traits<common_iterator<I, S>> {
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:552:36: error: 'common_iterator' was not declared in this scope; did you mean 'move_iterator'?
552 | struct incrementable_traits<common_iterator<I, S>> {
| ^~~~~~~~~~~~~~~
| move_iterator
p998.cpp:552:56: error: spurious '>>', use '>' to terminate a template argument list
552 | struct incrementable_traits<common_iterator<I, S>> {
| ^~
p998.cpp:553:16: error: expected nested-name-specifier before 'difference_type'
553 | using difference_type = iter_difference_t<I>;
| ^~~~~~~~~~~~~~~
p998.cpp:555:17: error: 'input_iterator' has not been declared
555 | template<input_iterator I, class S>
| ^~~~~~~~~~~~~~
p998.cpp:556:31: error: 'common_iterator' was not declared in this scope; did you mean 'move_iterator'?
556 | struct iterator_traits<common_iterator<I, S>> {
| ^~~~~~~~~~~~~~~
| move_iterator
p998.cpp:556:47: error: 'I' was not declared in this scope
556 | struct iterator_traits<common_iterator<I, S>> {
| ^
p998.cpp:556:51: error: spurious '>>', use '>' to terminate a template argument list
556 | struct iterator_traits<common_iterator<I, S>> {
| ^~
p998.cpp:556:51: error: wrong number of template arguments (2, should be 1)
In file included from /usr/local/include/c++/12.1.0/string:42:
/usr/local/include/c++/12.1.0/bits/cpp_type_traits.h:425:29: note: provided for 'template<class> struct std::iterator_traits'
425 | template<typename> struct iterator_traits;
| ^~~~~~~~~~~~~~~
p998.cpp:567:1: error: 'constexpr' does not name a type
567 | constexpr common_iterator(I i);
| ^~~~~~~~~
p998.cpp:567:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:571:3: error: 'requires' does not name a type
571 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
| ^~~~~~~~
p998.cpp:571:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:576:3: error: 'requires' does not name a type
576 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
| ^~~~~~~~
p998.cpp:576:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:585:1: error: 'constexpr' does not name a type
585 | constexpr decltype(auto) operator*();
| ^~~~~~~~~
p998.cpp:585:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:586:1: error: 'constexpr' does not name a type
586 | constexpr decltype(auto) operator*() const
| ^~~~~~~~~
p998.cpp:586:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:592:1: error: 'constexpr' does not name a type
592 | constexpr decltype(auto) operator->() const requires see_below;
| ^~~~~~~~~
p998.cpp:592:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:594:3: error: 'indirectly_readable' does not name a type
594 | indirectly_readable<const I> &&
| ^~~~~~~~~~~~~~~~~~~
p998.cpp:595:45: error: expected unqualified-id before '||' token
595 | (requires(const I& i) { i.operator->(); } ||
| ^~
p998.cpp:604:1: error: 'iter_value_t' does not name a type
604 | iter_value_t<I> keep_;
| ^~~~~~~~~~~~
p998.cpp:605:1: error: 'constexpr' does not name a type
605 | constexpr proxy(iter_reference_t<I>&& x)
| ^~~~~~~~~
p998.cpp:605:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:608:8: error: 'constexpr' does not name a type
608 | constexpr const iter_value_t<I>* operator->() const noexcept {
| ^~~~~~~~~
p998.cpp:608:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:612:1: error: 'constexpr' does not name a type
612 | constexpr common_iterator& operator++();
| ^~~~~~~~~
p998.cpp:612:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:613:1: error: 'constexpr' does not name a type
613 | constexpr decltype(auto) operator++(int);
| ^~~~~~~~~
p998.cpp:613:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:617:8: error: 'common_iterator' does not name a type
617 | common_iterator tmp = *this;
| ^~~~~~~~~~~~~~~
p998.cpp:618:8: error: expected unqualified-id before '++' token
618 | ++*this;
| ^~
p998.cpp:619:8: error: expected unqualified-id before 'return'
619 | return tmp;
| ^~~~~~
p998.cpp:621:8: error: 'move_constructible' does not name a type
621 | move_constructible<iter_value_t<I>>
| ^~~~~~~~~~~~~~~~~~
p998.cpp:624:26: error: expected unqualified-id before '++' token
624 | postfix-proxy p(**this); ++*this;
| ^~
p998.cpp:625:1: error: expected unqualified-id before 'return'
625 | return p;
| ^~~~~~
p998.cpp:627:14: error: expected unqualified-id before '-' token
627 | class postfix-proxy {
| ^
p998.cpp:636:20: error: 'sentinel_for' has not been declared
636 | template<class I2, sentinel_for<I> S2>
| ^~~~~~~~~~~~
p998.cpp:636:32: error: expected '>' before '<' token
636 | template<class I2, sentinel_for<I> S2>
| ^
p998.cpp:637:3: error: 'requires' does not name a type
637 | requires sentinel_for<S, I2>
| ^~~~~~~~
p998.cpp:637:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:640:20: error: 'sentinel_for' has not been declared
640 | template<class I2, sentinel_for<I> S2>
| ^~~~~~~~~~~~
p998.cpp:640:32: error: expected '>' before '<' token
640 | template<class I2, sentinel_for<I> S2>
| ^
p998.cpp:641:3: error: 'requires' does not name a type
641 | requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
| ^~~~~~~~
p998.cpp:641:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:646:10: error: 'sized_sentinel_for' has not been declared
646 | template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
| ^~~~~~~~~~~~~~~~~~
p998.cpp:646:28: error: expected '>' before '<' token
646 | template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
| ^
p998.cpp:647:3: error: 'requires' does not name a type
647 | requires sized_sentinel_for<S, I2>
| ^~~~~~~~
p998.cpp:647:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:653:1: error: 'friend' used outside of class
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^~~~~~
| ------
p998.cpp:653:8: error: 'constexpr' does not name a type
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^~~~~~~~~
p998.cpp:653:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:658:10: error: 'indirectly_swappable' has not been declared
658 | template<indirectly_swappable<I> I2, class S2>
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:658:30: error: expected '>' before '<' token
658 | template<indirectly_swappable<I> I2, class S2>
| ^
p998.cpp:659:3: error: 'friend' used outside of class
659 | friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
| ^~~~~~
| ------
p998.cpp:659:10: error: 'constexpr' does not name a type
659 | friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
| ^~~~~~~~~
p998.cpp:659:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:661:9: error: expected constructor, destructor, or type conversion before '(' token
661 | noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
| ^
p998.cpp:672:1: error: 'list' does not name a type
672 | list<string> s;
| ^~~~
p998.cpp:676:1: error: 'ranges' does not name a type
676 | ranges::copy(counted_iterator(s.begin(), 10), default_sentinel, back_inserter(v));
| ^~~~~~
p998.cpp:679:14: error: 'input_or_output_iterator' has not been declared
679 | template<input_or_output_iterator I>
| ^~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:682:13: error: expected nested-name-specifier before 'iterator_type'
682 | using iterator_type = I;
| ^~~~~~~~~~~~~
p998.cpp:683:13: error: expected nested-name-specifier before 'value_type'
683 | using value_type = iter_value_t<I>;
| ^~~~~~~~~~
p998.cpp:685:7: error: expected nested-name-specifier before 'iterator_concept'
685 | using iterator_concept = typename I::iterator_concept;
| ^~~~~~~~~~~~~~~~
p998.cpp:687:7: error: expected nested-name-specifier before 'iterator_category'
687 | using iterator_category = typename I::iterator_category; // present only
| ^~~~~~~~~~~~~~~~~
p998.cpp:689:7: error: 'constexpr' does not name a type
689 | constexpr counted_iterator() requires default_initializable<I> = default;
| ^~~~~~~~~
p998.cpp:689:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:690:7: error: 'constexpr' does not name a type
690 | constexpr counted_iterator(I x, iter_difference_t<I> n);
| ^~~~~~~~~
p998.cpp:690:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:692:9: error: 'requires' does not name a type
692 | requires convertible_to<const I2&, I>
| ^~~~~~~~
p998.cpp:692:9: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:695:9: error: 'requires' does not name a type
695 | requires assignable_from<I&, const I2&>
| ^~~~~~~~
p998.cpp:695:9: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:697:7: error: 'constexpr' does not name a type
697 | constexpr const I& base() const & noexcept;
| ^~~~~~~~~
p998.cpp:697:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:698:7: error: 'constexpr' does not name a type
698 | constexpr I base() &&;
| ^~~~~~~~~
p998.cpp:698:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:699:7: error: 'constexpr' does not name a type
699 | constexpr iter_difference_t<I> count() const noexcept;
| ^~~~~~~~~
p998.cpp:699:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:700:7: error: 'constexpr' does not name a type
700 | constexpr decltype(auto) operator*();
| ^~~~~~~~~
p998.cpp:700:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:701:7: error: 'constexpr' does not name a type
701 | constexpr decltype(auto) operator*() const
| ^~~~~~~~~
p998.cpp:701:7: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:705:3: error: 'constexpr' does not name a type
705 | constexpr auto operator->() const noexcept
| ^~~~~~~~~
p998.cpp:705:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:707:3: error: 'constexpr' does not name a type
707 | constexpr counted_iterator& operator++();
| ^~~~~~~~~
p998.cpp:707:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:708:3: error: 'constexpr' does not name a type
708 | constexpr decltype(auto) operator++(int);
| ^~~~~~~~~
p998.cpp:708:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:709:3: error: 'constexpr' does not name a type
709 | constexpr counted_iterator operator++(int)
| ^~~~~~~~~
p998.cpp:709:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:711:3: error: 'constexpr' does not name a type
711 | constexpr counted_iterator& operator--()
| ^~~~~~~~~
p998.cpp:711:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:713:3: error: 'constexpr' does not name a type
713 | constexpr counted_iterator operator--(int)
| ^~~~~~~~~
p998.cpp:713:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:715:3: error: 'constexpr' does not name a type
715 | constexpr counted_iterator operator+(iter_difference_t<I> n) const
| ^~~~~~~~~
p998.cpp:715:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:717:10: error: 'constexpr' does not name a type
717 | friend constexpr counted_iterator operator+(
| ^~~~~~~~~
p998.cpp:717:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:720:3: error: 'constexpr' does not name a type
720 | constexpr counted_iterator& operator+=(iter_difference_t<I> n)
| ^~~~~~~~~
p998.cpp:720:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:722:3: error: 'constexpr' does not name a type
722 | constexpr counted_iterator operator-(iter_difference_t<I> n) const
| ^~~~~~~~~
p998.cpp:722:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:724:12: error: 'common_with' has not been declared
724 | template<common_with<I> I2>
| ^~~~~~~~~~~
p998.cpp:724:23: error: expected '>' before '<' token
724 | template<common_with<I> I2>
| ^
p998.cpp:725:12: error: 'constexpr' does not name a type
725 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~~~~
p998.cpp:725:12: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:727:10: error: 'constexpr' does not name a type
727 | friend constexpr iter_difference_t<I> operator-(
| ^~~~~~~~~
p998.cpp:727:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:729:10: error: 'constexpr' does not name a type
729 | friend constexpr iter_difference_t<I> operator-(
| ^~~~~~~~~
p998.cpp:729:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:731:3: error: 'constexpr' does not name a type
731 | constexpr counted_iterator& operator-=(iter_difference_t<I> n)
| ^~~~~~~~~
p998.cpp:731:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:733:3: error: 'constexpr' does not name a type
733 | constexpr decltype(auto) operator[](iter_difference_t<I> n) const
| ^~~~~~~~~
p998.cpp:733:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:735:12: error: 'common_with' has not been declared
735 | template<common_with<I> I2>
| ^~~~~~~~~~~
p998.cpp:735:23: error: expected '>' before '<' token
735 | template<common_with<I> I2>
| ^
p998.cpp:736:12: error: 'constexpr' does not name a type
736 | friend constexpr bool operator==(
| ^~~~~~~~~
p998.cpp:736:12: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:738:10: error: 'constexpr' does not name a type
738 | friend constexpr bool operator==(
| ^~~~~~~~~
p998.cpp:738:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:740:12: error: 'common_with' has not been declared
740 | template<common_with<I> I2>
| ^~~~~~~~~~~
p998.cpp:740:23: error: expected '>' before '<' token
740 | template<common_with<I> I2>
| ^
p998.cpp:741:12: error: 'constexpr' does not name a type
741 | friend constexpr strong_ordering operator<=>(
| ^~~~~~~~~
p998.cpp:741:12: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:743:10: error: 'constexpr' does not name a type
743 | friend constexpr iter_rvalue_reference_t<I> iter_move(const counted_iterator& i)
| ^~~~~~~~~
p998.cpp:743:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:746:12: error: 'indirectly_swappable' has not been declared
746 | template<indirectly_swappable<I> I2>
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:746:32: error: expected '>' before '<' token
746 | template<indirectly_swappable<I> I2>
| ^
p998.cpp:747:12: error: 'constexpr' does not name a type
747 | friend constexpr void iter_swap(const counted_iterator& x, const counted_iterator<I2>& y)
| ^~~~~~~~~
p998.cpp:747:12: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:750:1: error: 'I' does not name a type
750 | I current = I(); // exposition only
| ^
p998.cpp:751:1: error: 'iter_difference_t' does not name a type
751 | iter_difference_t<I> length = 0; // exposition only
| ^~~~~~~~~~~~~~~~~
p998.cpp:753:10: error: 'input_iterator' has not been declared
753 | template<input_iterator I>
| ^~~~~~~~~~~~~~
p998.cpp:754:1: error: 'requires' does not name a type
754 | requires same_as<ITER_TRAITS (I), iterator_traits<I>>
| ^~~~~~~~
p998.cpp:754:1: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:758:4: error: expected declaration before '}' token
758 | }; }
| ^
p998.cpp:760:4: error: 'constexpr' does not name a type
760 | constexpr counted_iterator(I i, iter_difference_t<I> n);
| ^~~~~~~~~
p998.cpp:760:4: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:764:3: error: 'requires' does not name a type
764 | requires convertible_to<const I2&, I>
| ^~~~~~~~
p998.cpp:764:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:768:3: error: 'requires' does not name a type
768 | requires assignable_from<I&, const I2&>
| ^~~~~~~~
p998.cpp:768:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:772:1: error: 'constexpr' does not name a type
772 | constexpr const I& base() const & noexcept;
| ^~~~~~~~~
p998.cpp:772:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:775:1: error: 'constexpr' does not name a type
775 | constexpr iter_difference_t<I> count() const noexcept;
| ^~~~~~~~~
p998.cpp:775:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:778:1: error: 'constexpr' does not name a type
778 | constexpr decltype(auto) operator*();
| ^~~~~~~~~
p998.cpp:778:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:779:1: error: 'constexpr' does not name a type
779 | constexpr decltype(auto) operator*() const
| ^~~~~~~~~
p998.cpp:779:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:780:49: error: found ':' in nested-name-specifier, expected '::'
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^
| ::
p998.cpp:780:36: error: 'Preconditions' does not name a type
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^~~~~~~~~~~~~
p998.cpp:781:1: error: 'constexpr' does not name a type
781 | constexpr auto operator->() const noexcept
| ^~~~~~~~~
p998.cpp:781:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:784:3: error: 'requires' does not name a type
784 | requires random_access_iterator<I>;
| ^~~~~~~~
p998.cpp:784:3: note: 'requires' only available with '-std=c++20' or '-fconcepts'
p998.cpp:788:1: error: 'constexpr' does not name a type
788 | constexpr counted_iterator& operator++();
| ^~~~~~~~~
p998.cpp:788:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:790:3: error: expected unqualified-id before '++' token
790 | ++current;
| ^~
p998.cpp:791:3: error: expected unqualified-id before '--' token
791 | --length;
| ^~
p998.cpp:792:3: error: expected unqualified-id before 'return'
792 | return *this;
| ^~~~~~
p998.cpp:793:1: error: 'constexpr' does not name a type
793 | constexpr decltype(auto) operator++(int);
| ^~~~~~~~~
p998.cpp:793:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:795:1: error: expected unqualified-id before '--' token
795 | --length;
| ^~
p998.cpp:796:8: error: expected unqualified-id before 'try'
796 | try { return current++; }
| ^~~
p998.cpp:797:8: error: expected unqualified-id before 'catch'
797 | catch(...) { ++length; throw; }
| ^~~~~
p998.cpp:798:1: error: 'constexpr' does not name a type
798 | constexpr counted_iterator operator++(int)
| ^~~~~~~~~
p998.cpp:798:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:801:8: error: invalid use of template-name 'std::counted_iterator' without an argument list
801 | counted_iterator tmp = *this;
| ^~~~~~~~~~~~~~~~
p998.cpp:801:8: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++1'
p998.cpp:680:11: note: 'template<<declaration error> > class std::counted_iterator' declared here
680 | class counted_iterator {
| ^~~~~~~~~~~~~~~~
p998.cpp:802:8: error: expected unqualified-id before '++' token
802 | ++*this;
| ^~
p998.cpp:803:8: error: expected unqualified-id before 'return'
803 | return tmp;
| ^~~~~~
p998.cpp:804:3: error: 'constexpr' does not name a type
804 | constexpr counted_iterator& operator--()
| ^~~~~~~~~
p998.cpp:804:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:807:8: error: expected unqualified-id before '--' token
807 | --current;
| ^~
p998.cpp:808:8: error: expected unqualified-id before '++' token
808 | ++length;
| ^~
p998.cpp:809:8: error: expected unqualified-id before 'return'
809 | return *this;
| ^~~~~~
p998.cpp:810:3: error: 'constexpr' does not name a type
810 | constexpr counted_iterator operator--(int)
| ^~~~~~~~~
p998.cpp:810:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:813:8: error: invalid use of template-name 'std::counted_iterator' without an argument list
813 | counted_iterator tmp = *this;
| ^~~~~~~~~~~~~~~~
p998.cpp:813:8: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++1'
p998.cpp:680:11: note: 'template<<declaration error> > class std::counted_iterator' declared here
680 | class counted_iterator {
| ^~~~~~~~~~~~~~~~
p998.cpp:814:8: error: expected unqualified-id before '--' token
814 | --*this;
| ^~
p998.cpp:815:8: error: expected unqualified-id before 'return'
815 | return tmp;
| ^~~~~~
p998.cpp:816:3: error: 'constexpr' does not name a type
816 | constexpr counted_iterator operator+(iter_difference_t<I> n) const
| ^~~~~~~~~
p998.cpp:816:3: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:819:1: error: 'friend' used outside of class
819 | friend constexpr counted_iterator operator+(
| ^~~~~~
| ------
p998.cpp:819:8: error: 'constexpr' does not name a type
819 | friend constexpr counted_iterator operator+(
| ^~~~~~~~~
p998.cpp:819:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:823:1: error: 'constexpr' does not name a type
823 | constexpr counted_iterator& operator+=(iter_difference_t<I> n)
| ^~~~~~~~~
p998.cpp:823:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:826:6: error: 'current' does not name a type
826 | current += n;
| ^~~~~~~
p998.cpp:827:6: error: 'length' does not name a type
827 | length -= n;
| ^~~~~~
p998.cpp:828:6: error: expected unqualified-id before 'return'
828 | return *this;
| ^~~~~~
p998.cpp:829:1: error: 'constexpr' does not name a type
829 | constexpr counted_iterator operator-(iter_difference_t<I> n) const
| ^~~~~~~~~
p998.cpp:829:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:832:10: error: 'common_with' has not been declared
832 | template<common_with<I> I2>
| ^~~~~~~~~~~
p998.cpp:832:21: error: expected '>' before '<' token
832 | template<common_with<I> I2>
| ^
p998.cpp:833:3: error: 'friend' used outside of class
833 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~
| ------
p998.cpp:833:10: error: 'constexpr' does not name a type
833 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~~~~
p998.cpp:833:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:836:1: error: 'friend' used outside of class
836 | friend constexpr iter_difference_t<I> operator-(
| ^~~~~~
| ------
p998.cpp:836:8: error: 'constexpr' does not name a type
836 | friend constexpr iter_difference_t<I> operator-(
| ^~~~~~~~~
p998.cpp:836:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:839:21: error: expected unqualified-id before ',' token
839 | default_sentinel_t, const counted_iterator& y);
| ^
p998.cpp:839:23: error: expected unqualified-id before 'const'
839 | default_sentinel_t, const counted_iterator& y);
| ^~~~~
p998.cpp:841:1: error: 'constexpr' does not name a type
841 | constexpr counted_iterator& operator-=(iter_difference_t<I> n)
| ^~~~~~~~~
p998.cpp:841:1: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:844:8: error: 'current' does not name a type
844 | current -= n;
| ^~~~~~~
p998.cpp:845:8: error: 'length' does not name a type
845 | length += n;
| ^~~~~~
p998.cpp:846:8: error: expected unqualified-id before 'return'
846 | return *this;
| ^~~~~~
p998.cpp:848:10: error: 'common_with' has not been declared
848 | template<common_with<I> I2>
| ^~~~~~~~~~~
p998.cpp:848:21: error: expected '>' before '<' token
848 | template<common_with<I> I2>
| ^
p998.cpp:849:3: error: 'friend' used outside of class
849 | friend constexpr bool operator==(
| ^~~~~~
| ------
p998.cpp:849:10: error: 'constexpr' does not name a type
849 | friend constexpr bool operator==(
| ^~~~~~~~~
p998.cpp:849:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:852:1: error: 'friend' used outside of class
852 | friend constexpr bool operator==(
| ^~~~~~
| ------
p998.cpp:852:8: error: 'constexpr' does not name a type
852 | friend constexpr bool operator==(
| ^~~~~~~~~
p998.cpp:852:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:855:10: error: 'common_with' has not been declared
855 | template<common_with<I> I2>
| ^~~~~~~~~~~
p998.cpp:855:21: error: expected '>' before '<' token
855 | template<common_with<I> I2>
| ^
p998.cpp:856:3: error: 'friend' used outside of class
856 | friend constexpr strong_ordering operator<=>(
| ^~~~~~
| ------
p998.cpp:856:10: error: 'constexpr' does not name a type
856 | friend constexpr strong_ordering operator<=>(
| ^~~~~~~~~
p998.cpp:856:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:861:1: error: 'friend' used outside of class
861 | friend constexpr iter_rvalue_reference_t<I>
| ^~~~~~
| ------
p998.cpp:861:8: error: 'constexpr' does not name a type
861 | friend constexpr iter_rvalue_reference_t<I>
| ^~~~~~~~~
p998.cpp:861:8: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:867:10: error: 'indirectly_swappable' has not been declared
867 | template<indirectly_swappable<I> I2>
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:867:30: error: expected '>' before '<' token
867 | template<indirectly_swappable<I> I2>
| ^
p998.cpp:868:3: error: 'friend' used outside of class
868 | friend constexpr void
| ^~~~~~
| ------
p998.cpp:868:10: error: 'constexpr' does not name a type
868 | friend constexpr void
| ^~~~~~~~~
p998.cpp:868:10: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
p998.cpp:880:16: error: 'weakly_incrementable' has not been declared
880 | template<weakly_incrementable I>
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:881:16: error: 'constexpr' does not name a type
881 | friend constexpr bool operator==(unreachable_sentinel_t, const I&) noexcept
| ^~~~~~~~~
p998.cpp:881:16: note: C++11 'constexpr' only available with '-std=c++11' or '-std=gnu++11'
$ g++ p998.cpp -std=2b -o p998g -I. -Wall
p998.cpp:20:9: error: redefinition of 'class std::reverse_iterator<_Iterator>'
20 | class reverse_iterator {
| ^~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/string:47,
from /usr/local/include/c++/12.1.0/bits/locale_classes.h:40,
from /usr/local/include/c++/12.1.0/bits/ios_base.h:41,
from /usr/local/include/c++/12.1.0/ios:42,
from /usr/local/include/c++/12.1.0/ostream:38,
from /usr/local/include/c++/12.1.0/iostream:39,
from N4910.h:2,
from p998.cpp:10:
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: previous definition of 'class std::reverse_iterator<_Iterator>'
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:62:1: error: 'decl-specifier' in declaration of deduction guide
62 | constexpr reverse_iterator();
| ^~~~~~~~~
p998.cpp:62:11: error: deduction guide for 'std::reverse_iterator<_Iterator>' must have trailing return type
62 | constexpr reverse_iterator();
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:64:45: error: expected ')' before 'x'
64 | constexpr explicit reverse_iterator(Iterator x);
| ~ ^~
| )
p998.cpp:66:19: error: 'decl-specifier' in declaration of deduction guide
66 | template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:66:29: error: deduction guide for 'std::reverse_iterator<_Iterator>' must have trailing return type
66 | template<class U> constexpr reverse_iterator(const reverse_iterator<U>& u);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:69:13: error: deduced class type 'reverse_iterator' in function return type
69 | constexpr reverse_iterator&
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:74:1: error: 'Iterator' does not name a type
74 | Iterator tmp = current;
| ^~~~~~~~
p998.cpp:75:3: error: expected unqualified-id before 'return'
75 | return *--tmp;
| ^~~~~~
p998.cpp:77:11: error: 'Iterator' does not name a type
77 | constexpr Iterator base() const;
| ^~~~~~~~
p998.cpp:80:11: error: 'reference' does not name a type
80 | constexpr reference operator*() const;
| ^~~~~~~~~
p998.cpp:82:11: error: 'pointer' does not name a type
82 | constexpr pointer operator->() const
| ^~~~~~~
p998.cpp:84:54: error: expected unqualified-id before ')' token
84 | requires(const Iterator i) { i.operator->(); });
| ^
p998.cpp:86:11: error: 'unspecified' does not name a type
86 | constexpr unspecified operator[](difference_type n) const; // Returns: current[-n-1].
| ^~~~~~~~~~~
p998.cpp:88:28: error: declaration of 'operator+' as non-function
88 | constexpr reverse_iterator operator+(difference_type n) const;
| ^~~~~~~~
p998.cpp:88:38: error: 'difference_type' was not declared in this scope
88 | constexpr reverse_iterator operator+(difference_type n) const;
| ^~~~~~~~~~~~~~~
p998.cpp:90:28: error: declaration of 'operator-' as non-function
90 | constexpr reverse_iterator operator-(difference_type n) const;
| ^~~~~~~~
p998.cpp:90:38: error: 'difference_type' was not declared in this scope
90 | constexpr reverse_iterator operator-(difference_type n) const;
| ^~~~~~~~~~~~~~~
p998.cpp:92:11: error: deduced class type 'reverse_iterator' in function return type
92 | constexpr reverse_iterator& operator++();
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:94:11: error: deduced class type 'reverse_iterator' in function return type
94 | constexpr reverse_iterator operator++(int);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:96:27: error: invalid use of 'this' at top level
96 | reverse_iterator tmp = *this;
| ^~~~
p998.cpp:97:3: error: expected unqualified-id before '--' token
97 | --current;
| ^~
p998.cpp:98:3: error: expected unqualified-id before 'return'
98 | return tmp;
| ^~~~~~
p998.cpp:99:11: error: deduced class type 'reverse_iterator' in function return type
99 | constexpr reverse_iterator& operator--();
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:101:11: error: deduced class type 'reverse_iterator' in function return type
101 | constexpr reverse_iterator operator--(int);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:103:27: error: invalid use of 'this' at top level
103 | reverse_iterator tmp = *this;
| ^~~~
p998.cpp:104:3: error: expected unqualified-id before '++' token
104 | ++current;
| ^~
p998.cpp:105:3: error: expected unqualified-id before 'return'
105 | return tmp;
| ^~~~~~
p998.cpp:106:11: error: template placeholder type 'reverse_iterator<...auto...>' must be followed by a simple declarator-id
106 | constexpr reverse_iterator& operator+=(difference_type n);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:106:40: error: 'difference_type' was not declared in this scope
106 | constexpr reverse_iterator& operator+=(difference_type n);
| ^~~~~~~~~~~~~~~
p998.cpp:108:11: error: template placeholder type 'reverse_iterator<...auto...>' must be followed by a simple declarator-id
108 | constexpr reverse_iterator& operator-=(difference_type n);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:108:40: error: 'difference_type' was not declared in this scope
108 | constexpr reverse_iterator& operator-=(difference_type n);
| ^~~~~~~~~~~~~~~
p998.cpp:111:18: error: declaration of 'operator!=' as non-function
111 | constexpr bool operator!=(
| ^~~~~~~~
p998.cpp:113:1: error: expected primary-expression before 'template'
113 | template<class Iterator1, class Iterator2>
| ^~~~~~~~
p998.cpp:113:27: error: expected primary-expression before 'class'
113 | template<class Iterator1, class Iterator2>
| ^~~~~
p998.cpp:118:24: error: 'Iterator1' was not declared in this scope
118 | const reverse_iterator<Iterator1>& x,
| ^~~~~~~~~
p998.cpp:118:33: error: template argument 1 is invalid
118 | const reverse_iterator<Iterator1>& x,
| ^
p998.cpp:118:36: error: 'x' declared as reference but not initialized
118 | const reverse_iterator<Iterator1>& x,
| ^
p998.cpp:119:1: error: expected unqualified-id before 'const'
119 | const reverse_iterator<Iterator2>& y);
| ^~~~~
p998.cpp:158:11: error: template placeholder type 'const reverse_iterator<...auto...>' must be followed by a simple declarator-id
158 | iter_move(const reverse_iterator& i) noexcept(see_below); // Effects: Equivalent to:
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:132:11: note: 'template<class _Iterator> class std::reverse_iterator' declared here
132 | class reverse_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:158:47: error: 'see_below' was not declared in this scope
158 | iter_move(const reverse_iterator& i) noexcept(see_below); // Effects: Equivalent to:
| ^~~~~~~~~
p998.cpp:158:57: error: expected constructor, destructor, or type conversion before ';' token
158 | iter_move(const reverse_iterator& i) noexcept(see_below); // Effects: Equivalent to:
| ^
p998.cpp:159:17: error: 'i' was not declared in this scope
159 | auto tmp = i.base();
| ^
p998.cpp:160:6: error: expected unqualified-id before 'return'
160 | return ranges::iter_move(--tmp);
| ^~~~~~
p998.cpp:162:6: error: expected unqualified-id before 'noexcept'
162 | noexcept(ranges::iter_move(--declval<Iterator&>()))
| ^~~~~~~~
p998.cpp:168:18: error: request for member 'base' in 'x', which is of non-class type 'const int'
168 | auto xtmp = x.base();
| ^~~~
p998.cpp:169:16: error: 'y' was not declared in this scope; did you mean 'yn'?
169 | auto ytmp = y.base();
| ^
| yn
p998.cpp:170:21: error: expected constructor, destructor, or type conversion before '(' token
170 | ranges::iter_swap(--xtmp, --ytmp);
| ^
p998.cpp:172:36: error: 'Iterator' was not declared in this scope; did you mean 'operator>'?
172 | is_nothrow_copy_constructible_v<Iterator> &&
| ^~~~~~~~
| operator>
p998.cpp:172:4: error: 'is_nothrow_copy_constructible_v<<expression error> >' does not name a type
172 | is_nothrow_copy_constructible_v<Iterator> &&
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:186:14: error: redefinition of 'class std::back_insert_iterator<_Container>'
186 | class back_insert_iterator {
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:694:11: note: previous definition of 'class std::back_insert_iterator<_Container>'
694 | class back_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:204:50: error: expected ')' before '&' token
204 | constexpr explicit back_insert_iterator(Container& x);
| ~ ^
| )
p998.cpp:207:11: error: template placeholder type 'back_insert_iterator<...auto...>' must be followed by a simple declarator-id
207 | constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:694:11: note: 'template<class _Container> class std::back_insert_iterator' declared here
694 | class back_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:207:52: error: 'Container' has not been declared
207 | constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~
p998.cpp:207:73: error: expected '(' before '&&' token
207 | constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
| ^~
| (
p998.cpp:207:76: error: 'value' was not declared in this scope
207 | constexpr back_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~
p998.cpp:209:11: error: deduced class type 'back_insert_iterator' in function return type
209 | constexpr back_insert_iterator& operator*();
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:694:11: note: 'template<class _Container> class std::back_insert_iterator' declared here
694 | class back_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:211:11: error: deduced class type 'back_insert_iterator' in function return type
211 | constexpr back_insert_iterator& operator++();
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:694:11: note: 'template<class _Container> class std::back_insert_iterator' declared here
694 | class back_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:212:11: error: deduced class type 'back_insert_iterator' in function return type
212 | constexpr back_insert_iterator operator++(int);
| ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:694:11: note: 'template<class _Container> class std::back_insert_iterator' declared here
694 | class back_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:221:11: error: redefinition of 'class std::front_insert_iterator<_Container>'
221 | class front_insert_iterator {
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: previous definition of 'class std::front_insert_iterator<_Container>'
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:243:36: error: expected ')' before '&' token
243 | constexpr insert_iterator(Container& x, ranges::iterator_t<Container> i);
| ~ ^
| )
p998.cpp:245:15: error: deduced class type 'front_insert_iterator' in function return type
245 | constexpr front_insert_iterator& operator*();
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:246:15: error: deduced class type 'front_insert_iterator' in function return type
246 | constexpr front_insert_iterator& operator++();
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:247:15: error: deduced class type 'front_insert_iterator' in function return type
247 | constexpr front_insert_iterator operator++(int);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:248:1: error: expected declaration before '}' token
248 | }; }
| ^
p998.cpp:248:4: error: expected declaration before '}' token
248 | }; }
| ^
p998.cpp:250:51: error: expected ')' before '&' token
250 | constexpr explicit front_insert_iterator(Container& x);
| ~ ^
| )
p998.cpp:253:11: error: template placeholder type 'front_insert_iterator<...auto...>' must be followed by a simple declarator-id
253 | constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:253:53: error: 'Container' has not been declared
253 | constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~
p998.cpp:253:74: error: expected '(' before '&&' token
253 | constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
| ^~
| (
p998.cpp:253:77: error: 'value' was not declared in this scope
253 | constexpr front_insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~
p998.cpp:255:11: error: deduced class type 'front_insert_iterator' in function return type
255 | constexpr front_insert_iterator& operator*();
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:257:11: error: deduced class type 'front_insert_iterator' in function return type
257 | constexpr front_insert_iterator& operator++();
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:258:11: error: deduced class type 'front_insert_iterator' in function return type
258 | constexpr front_insert_iterator operator++(int);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:795:11: note: 'template<class _Container> class std::front_insert_iterator' declared here
795 | class front_insert_iterator
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:267:11: error: redefinition of 'class std::insert_iterator<_Container>'
267 | class insert_iterator {
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:900:11: note: previous definition of 'class std::insert_iterator<_Container>'
900 | class insert_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:284:1: error: expected unqualified-id before '++' token
284 | ++iter;
| ^~
p998.cpp:286:11: error: template placeholder type 'insert_iterator<...auto...>' must be followed by a simple declarator-id
286 | constexpr insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:900:11: note: 'template<class _Container> class std::insert_iterator' declared here
900 | class insert_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:286:47: error: 'Container' has not been declared
286 | constexpr insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~~~~~
p998.cpp:286:68: error: expected '(' before '&&' token
286 | constexpr insert_iterator& operator=(typename Container::value_type&& value);
| ^~
| (
p998.cpp:286:71: error: 'value' was not declared in this scope
286 | constexpr insert_iterator& operator=(typename Container::value_type&& value);
| ^~~~~
p998.cpp:288:1: error: 'iter' does not name a type
288 | iter = container->insert(iter, std::move(value));
| ^~~~
p998.cpp:289:1: error: expected unqualified-id before '++' token
289 | ++iter;
| ^~
p998.cpp:291:11: error: deduced class type 'insert_iterator' in function return type
291 | constexpr insert_iterator& operator*();
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:900:11: note: 'template<class _Container> class std::insert_iterator' declared here
900 | class insert_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:293:11: error: deduced class type 'insert_iterator' in function return type
293 | constexpr insert_iterator& operator++();
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:900:11: note: 'template<class _Container> class std::insert_iterator' declared here
900 | class insert_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:294:11: error: deduced class type 'insert_iterator' in function return type
294 | constexpr insert_iterator& operator++(int);
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:900:11: note: 'template<class _Container> class std::insert_iterator' declared here
900 | class insert_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:305:1: error: 'list' does not name a type
305 | list<string> s;
| ^~~~
p998.cpp:307:19: error: 's' was not declared in this scope; did you mean 'ws'?
307 | vector<string> v1(s.begin(), s.end()); // copies strings into v1 vector<string> v2(make_move_iterator(s.begin()),
| ^
| ws
p998.cpp:307:30: error: 's' was not declared in this scope; did you mean 'ws'?
307 | vector<string> v1(s.begin(), s.end()); // copies strings into v1 vector<string> v2(make_move_iterator(s.begin()),
| ^
| ws
p998.cpp:308:19: error: expected constructor, destructor, or type conversion before '(' token
308 | make_move_iterator(s.end())); // moves strings into v2
| ^
p998.cpp:316:27: error: 'see_below' does not name a type
316 | using iterator_category = see_below ;
| ^~~~~~~~~
p998.cpp:350:61: warning: friend declaration 'constexpr std::iter_rvalue_reference_t<_In> std::std::iter_move(const move_iterator<Iterator>&)' declares a non-template function [-Wnon-template-friend]
350 | noexcept(noexcept(ranges::iter_move(i.current)));
| ^
p998.cpp:350:61: note: (if this is not what you intended, make sure the function template has already been declared and add '<>' after the function name here)
p998.cpp:362:6: error: 'decl-specifier' in declaration of deduction guide
362 | constexpr move_iterator();
| ^~~~~~~~~
p998.cpp:362:16: error: deduction guide for 'std::move_iterator<_Iterator>' must have trailing return type
362 | constexpr move_iterator();
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:366:19: error: 'decl-specifier' in declaration of deduction guide
366 | template<class U> constexpr move_iterator(const move_iterator<U>& u);
| ^~~~~~~~~
p998.cpp:366:29: error: deduction guide for 'std::move_iterator<_Iterator>' must have trailing return type
366 | template<class U> constexpr move_iterator(const move_iterator<U>& u);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:368:32: error: deduced class type 'move_iterator' in function return type
368 | template<class U> constexpr move_iterator& operator=(const move_iterator<U>& u);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:372:17: error: 'Iterator' does not name a type; did you mean 'iterator'?
372 | constexpr const Iterator& base() const & noexcept;
| ^~~~~~~~
| iterator
p998.cpp:376:11: error: 'reference' does not name a type; did you mean 'is_reference'?
376 | constexpr reference operator*() const;
| ^~~~~~~~~
| is_reference
p998.cpp:380:11: error: deduced class type 'move_iterator' in function return type
380 | constexpr move_iterator& operator++();
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:382:16: error: 'constexpr auto std::operator++(int)' must have an argument of class or enumerated type
382 | constexpr auto operator++(int);
| ^~~~~~~~
p998.cpp:384:24: error: invalid use of 'this' at top level
384 | move_iterator tmp = *this;
| ^~~~
p998.cpp:385:3: error: expected unqualified-id before '++' token
385 | ++current;
| ^~
p998.cpp:386:3: error: expected unqualified-id before 'return'
386 | return tmp;
| ^~~~~~
p998.cpp:388:11: error: deduced class type 'move_iterator' in function return type
388 | constexpr move_iterator& operator--();
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:390:11: error: deduced class type 'move_iterator' in function return type
390 | constexpr move_iterator operator--(int);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:392:24: error: invalid use of 'this' at top level
392 | move_iterator tmp = *this;
| ^~~~
p998.cpp:393:3: error: expected unqualified-id before '--' token
393 | --current;
| ^~
p998.cpp:394:3: error: expected unqualified-id before 'return'
394 | return tmp;
| ^~~~~~
p998.cpp:395:25: error: declaration of 'operator+' as non-function
395 | constexpr move_iterator operator+(difference_type n) const;
| ^~~~~~~~
p998.cpp:395:35: error: 'difference_type' was not declared in this scope
395 | constexpr move_iterator operator+(difference_type n) const;
| ^~~~~~~~~~~~~~~
p998.cpp:397:11: error: template placeholder type 'move_iterator<...auto...>' must be followed by a simple declarator-id
397 | constexpr move_iterator& operator+=(difference_type n);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:397:37: error: 'difference_type' was not declared in this scope
397 | constexpr move_iterator& operator+=(difference_type n);
| ^~~~~~~~~~~~~~~
p998.cpp:399:25: error: declaration of 'operator-' as non-function
399 | constexpr move_iterator operator-(difference_type n) const;
| ^~~~~~~~
p998.cpp:399:35: error: 'difference_type' was not declared in this scope
399 | constexpr move_iterator operator-(difference_type n) const;
| ^~~~~~~~~~~~~~~
p998.cpp:401:11: error: template placeholder type 'move_iterator<...auto...>' must be followed by a simple declarator-id
401 | constexpr move_iterator& operator-=(difference_type n);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:401:37: error: 'difference_type' was not declared in this scope
401 | constexpr move_iterator& operator-=(difference_type n);
| ^~~~~~~~~~~~~~~
p998.cpp:405:1: error: 'friend' used outside of class
405 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~
| ------
p998.cpp:405:36: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
405 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~~~
| iterator
p998.cpp:405:44: error: template argument 1 is invalid
405 | friend constexpr iter_difference_t<Iterator>
| ^
p998.cpp:406:13: error: template placeholder type 'const move_iterator<...auto...>' must be followed by a simple declarator-id
406 | operator-(const move_iterator& x, const move_sentinel<S>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:406:35: error: expected ')' before ',' token
406 | operator-(const move_iterator& x, const move_sentinel<S>& y);
| ~ ^
| )
p998.cpp:406:3: error: 'constexpr int std::operator-(...)' must have an argument of class or enumerated type
406 | operator-(const move_iterator& x, const move_sentinel<S>& y);
| ^~~~~~~~
p998.cpp:406:37: error: expected unqualified-id before 'const'
406 | operator-(const move_iterator& x, const move_sentinel<S>& y);
| ^~~~~
p998.cpp:412:23: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
412 | template<sentinel_for<Iterator> S>
| ^~~~~~~~
| iterator
p998.cpp:412:10: error: template argument 2 is invalid
412 | template<sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~~~~~
p998.cpp:413:3: error: 'friend' used outside of class
413 | friend constexpr bool operator==(const move_iterator& x,
| ^~~~~~
| ------
p998.cpp:413:36: error: template placeholder type 'const move_iterator<...auto...>' must be followed by a simple declarator-id
413 | friend constexpr bool operator==(const move_iterator& x,
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:413:58: error: expected ')' before ',' token
413 | friend constexpr bool operator==(const move_iterator& x,
| ~ ^
| )
p998.cpp:413:25: error: 'constexpr bool std::operator==(...)' must have an argument of class or enumerated type
413 | friend constexpr bool operator==(const move_iterator& x,
| ^~~~~~~~
p998.cpp:436:29: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
436 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~
| iterator
p998.cpp:436:10: error: template argument 2 is invalid
436 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:437:3: error: 'friend' used outside of class
437 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~
| ------
p998.cpp:437:38: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
437 | friend constexpr iter_difference_t<Iterator>
| ^~~~~~~~
| iterator
p998.cpp:437:46: error: template argument 1 is invalid
437 | friend constexpr iter_difference_t<Iterator>
| ^
p998.cpp:438:35: error: 'S' was not declared in this scope
438 | operator-(const move_sentinel<S>& x, const move_iterator& y);
| ^
p998.cpp:438:36: error: template argument 1 is invalid
438 | operator-(const move_sentinel<S>& x, const move_iterator& y);
| ^
p998.cpp:438:42: error: template placeholder type 'const move_iterator<...auto...>' must be followed by a simple declarator-id
438 | operator-(const move_sentinel<S>& x, const move_iterator& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:438:5: error: 'constexpr int std::operator-(...)' must have an argument of class or enumerated type
438 | operator-(const move_sentinel<S>& x, const move_iterator& y);
| ^~~~~~~~
p998.cpp:439:29: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
439 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~
| iterator
p998.cpp:439:10: error: template argument 2 is invalid
439 | template<sized_sentinel_for<Iterator> S>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:442:1: error: too many template-parameter-lists
442 | operator+(iter_difference_t<Iterator> n, const move_iterator<Iterator>& x);
| ^~~~~~~~
p998.cpp:444:1: error: 'friend' used outside of class
444 | friend constexpr iter_rvalue_reference_t<Iterator>
| ^~~~~~
| ------
p998.cpp:444:42: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
444 | friend constexpr iter_rvalue_reference_t<Iterator>
| ^~~~~~~~
| iterator
p998.cpp:444:50: error: template argument 1 is invalid
444 | friend constexpr iter_rvalue_reference_t<Iterator>
| ^
p998.cpp:445:13: error: template placeholder type 'const move_iterator<...auto...>' must be followed by a simple declarator-id
445 | iter_move(const move_iterator& i)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:446:41: error: 'i' was not declared in this scope
446 | noexcept(noexcept(ranges::iter_move(i.current)));
| ^
p998.cpp:449:31: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
449 | template<indirectly_swappable<Iterator> Iterator2>
| ^~~~~~~~
| iterator
p998.cpp:449:10: error: template argument 2 is invalid
449 | template<indirectly_swappable<Iterator> Iterator2>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:450:3: error: 'friend' used outside of class
450 | friend constexpr void
| ^~~~~~
| ------
p998.cpp:451:15: error: template placeholder type 'const move_iterator<...auto...>' must be followed by a simple declarator-id
451 | iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1445:11: note: 'template<class _Iterator> class std::move_iterator' declared here
1445 | class move_iterator
| ^~~~~~~~~~~~~
p998.cpp:451:37: error: expected ')' before ',' token
451 | iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y)
| ~ ^
| )
p998.cpp:451:37: error: expected ';' before ',' token
451 | iter_swap(const move_iterator& x, const move_iterator<Iterator2>& y)
| ^
| ;
p998.cpp:454:25: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
454 | constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
| ^~~~~~~~
| iterator
p998.cpp:454:33: error: template argument 1 is invalid
454 | constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
| ^
p998.cpp:454:54: error: 'constexpr const int std::make_move_iterator' redeclared as different kind of entity
454 | constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
| ^~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1793:5: note: previous declaration 'template<class _Iterator> constexpr std::move_iterator<_IteratorL> std::make_move_iterator(_Iterator)'
1793 | make_move_iterator(_Iterator __i)
| ^~~~~~~~~~~~~~~~~~
p998.cpp:454:54: error: 'Iterator' was not declared in this scope; did you mean 'iterator'?
454 | constexpr move_iterator<Iterator> make_move_iterator(Iterator i);
| ^~~~~~~~
| iterator
p998.cpp: In function 'void std::move_if(I, S, O, Pred)':
p998.cpp:463:13: error: 'std::std::ranges' has not been declared
463 | std::ranges::copy_if(move_iterator<I>{first}, move_sentinel<S>{last}, out, pred);
| ^~~~~~
p998.cpp: At global scope:
p998.cpp:483:1: error: 'decl-specifier' in declaration of deduction guide
483 | constexpr move_sentinel();
| ^~~~~~~~~
p998.cpp:483:11: error: deduction guide for 'std::move_sentinel<_Sent>' must have trailing return type
483 | constexpr move_sentinel();
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1377:11: note: 'template<class _Sent> requires semiregular<_Sent> class std::move_sentinel' declared here
1377 | class move_sentinel
| ^~~~~~~~~~~~~
p998.cpp:484:35: error: expected ')' before 's'
484 | constexpr explicit move_sentinel(S s);
| ~ ^~
| )
p998.cpp:487:38: error: 'S' was not declared in this scope; did you mean 'S2'?
487 | requires convertible_to<const S2&, S>
| ^
| S2
p998.cpp:487:12: error: template argument 2 is invalid
487 | requires convertible_to<const S2&, S>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:488:1: error: 'decl-specifier' in declaration of deduction guide
488 | constexpr move_sentinel(const move_sentinel<S2>& s);
| ^~~~~~~~~
p998.cpp:488:11: error: deduction guide for 'std::move_sentinel<_Sent>' must have trailing return type
488 | constexpr move_sentinel(const move_sentinel<S2>& s);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1377:11: note: 'template<class _Sent> requires semiregular<_Sent> class std::move_sentinel' declared here
1377 | class move_sentinel
| ^~~~~~~~~~~~~
p998.cpp:492:28: error: 'S' was not declared in this scope; did you mean 'S2'?
492 | requires assignable_from<S&, const S2&>
| ^
| S2
p998.cpp:492:12: error: parse error in template argument list
492 | requires assignable_from<S&, const S2&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:492:12: error: template argument 1 is invalid
p998.cpp:493:15: error: deduced class type 'move_sentinel' in function return type
493 | constexpr move_sentinel& operator=(const move_sentinel<S2>& s);
| ^~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1377:11: note: 'template<class _Sent> requires semiregular<_Sent> class std::move_sentinel' declared here
1377 | class move_sentinel
| ^~~~~~~~~~~~~
p998.cpp:502:1: error: 'list' does not name a type
502 | list<int> s;
| ^~~~
p998.cpp:504:45: error: 'list' was not declared in this scope
504 | using CI = common_iterator<counted_iterator<list<int>::iterator>, default_sentinel_t>; // call fun on a range of 10 ints
| ^~~~
p998.cpp:11:1: note: 'std::list' is defined in header '<list>'; did you forget to '#include <list>'?
10 | #include "N4910.h"
+++ |+#include <list>
11 |
p998.cpp:504:53: error: template argument 1 is invalid
504 | using CI = common_iterator<counted_iterator<list<int>::iterator>, default_sentinel_t>; // call fun on a range of 10 ints
| ^
p998.cpp:504:64: error: wrong number of template arguments (1, should be 2)
504 | using CI = common_iterator<counted_iterator<list<int>::iterator>, default_sentinel_t>; // call fun on a range of 10 ints
| ^
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: provided for 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator'
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:505:4: error: expected constructor, destructor, or type conversion before '(' token
505 | fun(CI(counted_iterator(s.begin(), 10)), CI(default_sentinel));
| ^
p998.cpp:523:10: error: 'dereferenceable' was not declared in this scope
523 | requires dereferenceable<const I>; constexpr decltype(auto) operator->() const
| ^~~~~~~~~~~~~~~
p998.cpp:523:1: error: expression must be enclosed in parentheses
523 | requires dereferenceable<const I>; constexpr decltype(auto) operator->() const
| ^~~~~~~~
p998.cpp:523:1: error: expected ';' at end of member declaration
523 | requires dereferenceable<const I>; constexpr decltype(auto) operator->() const
| ^~~~~~~~
| ;
p998.cpp:523:10: error: 'dereferenceable' does not name a type
523 | requires dereferenceable<const I>; constexpr decltype(auto) operator->() const
| ^~~~~~~~~~~~~~~
p998.cpp:542:54: error: constraints on a non-templated function
542 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^~~~~~~~~
p998.cpp:544:23: warning: friend declaration 'constexpr std::iter_rvalue_reference_t<_In> std::std::iter_move(const common_iterator<I, S>&)' declares a non-template function [-Wnon-template-friend]
544 | requires input_iterator<I>;
| ^~~~~~~~~~~~~~~~~
p998.cpp:552:15: error: specialization of 'template<class> struct std::incrementable_traits' in different namespace [-fpermissive]
552 | struct incrementable_traits<common_iterator<I, S>> {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/c++/12.1.0/bits/stl_iterator_base_types.h:71,
from /usr/local/include/c++/12.1.0/bits/stl_construct.h:61,
from /usr/local/include/c++/12.1.0/bits/char_traits.h:46,
from /usr/local/include/c++/12.1.0/ios:40:
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:150:29: note: from definition of 'template<class> struct std::incrementable_traits'
150 | template<typename> struct incrementable_traits { };
| ^~~~~~~~~~~~~~~~~~~~
p998.cpp:556:15: error: specialization of 'template<class _Iterator> struct std::iterator_traits' in different namespace [-fpermissive]
556 | struct iterator_traits<common_iterator<I, S>> {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:52:12: note: from definition of 'template<class _Iterator> struct std::iterator_traits'
52 | struct iterator_traits;
| ^~~~~~~~~~~~~~~
p998.cpp:557:26: error: 'see_below' does not name a type
557 | using iterator_concept = see_below;
| ^~~~~~~~~
p998.cpp:558:27: error: 'see_below' does not name a type
558 | using iterator_category = see_below;
| ^~~~~~~~~
p998.cpp:560:63: error: 'see_below' does not name a type
560 | using difference_type = iter_difference_t<I>; using pointer = see_below;
| ^~~~~~~~~
p998.cpp:567:28: error: expected ')' before 'i'
567 | constexpr common_iterator(I i);
| ~ ^~
| )
p998.cpp:571:38: error: 'I' was not declared in this scope; did you mean 'I2'?
571 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
| ^
| I2
p998.cpp:571:12: error: template argument 2 is invalid
571 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:571:70: error: 'S' was not declared in this scope; did you mean 'S2'?
571 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
| ^
| S2
p998.cpp:571:44: error: template argument 2 is invalid
571 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:572:1: error: 'decl-specifier' in declaration of deduction guide
572 | constexpr common_iterator(const common_iterator<I2, S2>& x);
| ^~~~~~~~~
p998.cpp:572:11: error: deduction guide for 'std::common_iterator<_It, _Sent>' must have trailing return type
572 | constexpr common_iterator(const common_iterator<I2, S2>& x);
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:576:38: error: 'I' was not declared in this scope; did you mean 'I2'?
576 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
| ^
| I2
p998.cpp:576:12: error: template argument 2 is invalid
576 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:576:70: error: 'S' was not declared in this scope; did you mean 'S2'?
576 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
| ^
| S2
p998.cpp:576:44: error: template argument 2 is invalid
576 | requires convertible_to<const I2&, I> && convertible_to<const S2&, S> &&
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:577:28: error: 'I' was not declared in this scope; did you mean 'I2'?
577 | assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
| ^
| I2
p998.cpp:577:12: error: parse error in template argument list
577 | assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:577:12: error: template argument 1 is invalid
p998.cpp:577:62: error: 'S' was not declared in this scope; did you mean 'S2'?
577 | assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
| ^
| S2
p998.cpp:577:46: error: parse error in template argument list
577 | assignable_from<I&, const I2&> && assignable_from<S&, const S2&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:577:46: error: template argument 1 is invalid
p998.cpp:578:15: error: deduced class type 'common_iterator' in function return type
578 | constexpr common_iterator& operator=(const common_iterator<I2, S2>& x);
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:585:26: error: 'constexpr decltype(auto) std::operator*()' must have an argument of class or enumerated type
585 | constexpr decltype(auto) operator*();
| ^~~~~~~~
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
589 | requires dereferenceable<const I>;
| ^
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:589:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:589:10: error: 'dereferenceable' was not declared in this scope
589 | requires dereferenceable<const I>;
| ^~~~~~~~~~~~~~~
p998.cpp:589:1: error: expression must be enclosed in parentheses
589 | requires dereferenceable<const I>;
| ^~~~~~~~
p998.cpp:589:10: error: expected initializer before 'dereferenceable'
589 | requires dereferenceable<const I>;
| ^~~~~~~~~~~~~~~
p998.cpp:592:26: error: constraints on a non-templated function
592 | constexpr decltype(auto) operator->() const requires see_below;
| ^~~~~~~~
p998.cpp:592:54: error: non-member function 'constexpr decltype(auto) std::operator->()' cannot have cv-qualifier
592 | constexpr decltype(auto) operator->() const requires see_below;
| ^~~~~~~~~
p998.cpp:592:26: error: 'constexpr decltype(auto) std::operator->()' must be a non-static member function
592 | constexpr decltype(auto) operator->() const requires see_below;
| ^~~~~~~~
p998.cpp:594:29: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
594 | indirectly_readable<const I> &&
| ^
p998.cpp:594:3: error: parse error in template argument list
594 | indirectly_readable<const I> &&
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:594:3: error: template argument 1 is invalid
p998.cpp:594:3: error: '<expression error>' does not name a type
p998.cpp:595:45: error: expected unqualified-id before '||' token
595 | (requires(const I& i) { i.operator->(); } ||
| ^~
p998.cpp:604:14: error: 'I' was not declared in this scope
604 | iter_value_t<I> keep_;
| ^
p998.cpp:604:15: error: template argument 1 is invalid
604 | iter_value_t<I> keep_;
| ^
p998.cpp:605:34: error: 'I' was not declared in this scope
605 | constexpr proxy(iter_reference_t<I>&& x)
| ^
p998.cpp:605:35: error: template argument 1 is invalid
605 | constexpr proxy(iter_reference_t<I>&& x)
| ^
p998.cpp:608:37: error: 'I' was not declared in this scope
608 | constexpr const iter_value_t<I>* operator->() const noexcept {
| ^
p998.cpp:608:38: error: template argument 1 is invalid
608 | constexpr const iter_value_t<I>* operator->() const noexcept {
| ^
p998.cpp: In constructor 'constexpr std::proxy::proxy(int&&)':
p998.cpp:606:23: error: 'move' is not a member of 'std::std'
606 | : keep_(std::move(x)) {}
| ^~~~
p998.cpp:606:23: note: suggested alternatives:
In file included from /usr/local/include/c++/12.1.0/string:50:
/usr/local/include/c++/12.1.0/bits/stl_algobase.h:644:5: note: 'std::move'
644 | move(_II __first, _II __last, _OI __result)
| ^~~~
In file included from /usr/local/include/c++/12.1.0/bits/ranges_uninitialized.h:36,
from /usr/local/include/c++/12.1.0/memory:86,
from N4910.h:14:
/usr/local/include/c++/12.1.0/bits/ranges_algobase.h:344:30: note: 'std::ranges::move'
344 | inline constexpr __move_fn move{};
| ^~~~
p998.cpp: At global scope:
p998.cpp:612:11: error: deduced class type 'common_iterator' in function return type
612 | constexpr common_iterator& operator++();
| ^~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:613:26: error: 'constexpr decltype(auto) std::operator++(int)' must have an argument of class or enumerated type
613 | constexpr decltype(auto) operator++(int);
| ^~~~~~~~
p998.cpp:617:31: error: invalid use of 'this' at top level
617 | common_iterator tmp = *this;
| ^~~~
p998.cpp:618:8: error: expected unqualified-id before '++' token
618 | ++*this;
| ^~
p998.cpp:619:8: error: expected unqualified-id before 'return'
619 | return tmp;
| ^~~~~~
p998.cpp:621:40: error: 'I' was not declared in this scope
621 | move_constructible<iter_value_t<I>>
| ^
p998.cpp:621:40: error: template argument 1 is invalid
p998.cpp:621:8: error: template argument 1 is invalid
621 | move_constructible<iter_value_t<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:621:8: error: '<expression error>' does not name a type
p998.cpp:624:26: error: expected unqualified-id before '++' token
624 | postfix-proxy p(**this); ++*this;
| ^~
p998.cpp:625:1: error: expected unqualified-id before 'return'
625 | return p;
| ^~~~~~
p998.cpp:627:14: error: expected unqualified-id before '-' token
627 | class postfix-proxy {
| ^
p998.cpp:636:33: error: 'I' was not declared in this scope; did you mean 'I2'?
636 | template<class I2, sentinel_for<I> S2>
| ^
| I2
p998.cpp:636:20: error: template argument 2 is invalid
636 | template<class I2, sentinel_for<I> S2>
| ^~~~~~~~~~~~~~~
p998.cpp:637:25: error: 'S' was not declared in this scope
637 | requires sentinel_for<S, I2>
| ^
p998.cpp:637:12: error: template argument 1 is invalid
637 | requires sentinel_for<S, I2>
| ^~~~~~~~~~~~~~~~~~~
p998.cpp:638:1: error: 'friend' used outside of class
638 | friend constexpr bool operator==(
| ^~~~~~
| ------
p998.cpp:639:3: error: template placeholder type 'const common_iterator<...auto...>' must be followed by a simple declarator-id
639 | const common_iterator& x, const common_iterator<I2, S2>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:639:27: error: expected ')' before ',' token
639 | const common_iterator& x, const common_iterator<I2, S2>& y);
| ^
| )
p998.cpp:638:33: note: to match this '('
638 | friend constexpr bool operator==(
| ^
p998.cpp:638:23: error: 'constexpr bool std::operator==(...)' must have an argument of class or enumerated type
638 | friend constexpr bool operator==(
| ^~~~~~~~
p998.cpp:640:33: error: 'I' was not declared in this scope; did you mean 'I2'?
640 | template<class I2, sentinel_for<I> S2>
| ^
| I2
p998.cpp:640:20: error: template argument 2 is invalid
640 | template<class I2, sentinel_for<I> S2>
| ^~~~~~~~~~~~~~~
p998.cpp:641:25: error: 'S' was not declared in this scope
641 | requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
| ^
p998.cpp:641:12: error: template argument 1 is invalid
641 | requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
| ^~~~~~~~~~~~~~~~~~~
p998.cpp:641:60: error: 'I' was not declared in this scope; did you mean 'I2'?
641 | requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
| ^
| I2
p998.cpp:641:35: error: template argument 1 is invalid
641 | requires sentinel_for<S, I2> && equality_comparable_with<I, I2>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:642:1: error: 'friend' used outside of class
642 | friend constexpr bool operator==(
| ^~~~~~
| ------
p998.cpp:643:3: error: template placeholder type 'const common_iterator<...auto...>' must be followed by a simple declarator-id
643 | const common_iterator& x, const common_iterator<I2, S2>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:643:27: error: expected ')' before ',' token
643 | const common_iterator& x, const common_iterator<I2, S2>& y);
| ^
| )
p998.cpp:642:33: note: to match this '('
642 | friend constexpr bool operator==(
| ^
p998.cpp:642:23: error: 'constexpr bool std::operator==(...)' must have an argument of class or enumerated type
642 | friend constexpr bool operator==(
| ^~~~~~~~
p998.cpp:646:29: error: 'I' was not declared in this scope
646 | template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
| ^
p998.cpp:646:10: error: template argument 2 is invalid
646 | template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:646:55: error: 'I' was not declared in this scope
646 | template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
| ^
p998.cpp:646:36: error: template argument 2 is invalid
646 | template<sized_sentinel_for<I> I2, sized_sentinel_for<I> S2>
| ^~~~~~~~~~~~~~~~~~~~~
p998.cpp:647:31: error: 'S' was not declared in this scope
647 | requires sized_sentinel_for<S, I2>
| ^
p998.cpp:647:34: error: 'I2' was not declared in this scope
647 | requires sized_sentinel_for<S, I2>
| ^~
p998.cpp:647:12: error: template argument 1 is invalid
647 | requires sized_sentinel_for<S, I2>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:647:12: error: template argument 2 is invalid
p998.cpp:648:1: error: 'friend' used outside of class
648 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~
| ------
p998.cpp:648:36: error: 'I2' was not declared in this scope
648 | friend constexpr iter_difference_t<I2> operator-(
| ^~
p998.cpp:648:38: error: template argument 1 is invalid
648 | friend constexpr iter_difference_t<I2> operator-(
| ^
p998.cpp:649:3: error: template placeholder type 'const common_iterator<...auto...>' must be followed by a simple declarator-id
649 | const common_iterator& x, const common_iterator<I2, S2>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:649:27: error: expected ')' before ',' token
649 | const common_iterator& x, const common_iterator<I2, S2>& y);
| ^
| )
p998.cpp:648:49: note: to match this '('
648 | friend constexpr iter_difference_t<I2> operator-(
| ^
p998.cpp:648:40: error: 'constexpr int std::operator-(...)' must have an argument of class or enumerated type
648 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~~~
p998.cpp:653:1: error: 'friend' used outside of class
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^~~~~~
| ------
p998.cpp:653:42: error: 'I' was not declared in this scope
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^
p998.cpp:653:43: error: template argument 1 is invalid
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^
p998.cpp:653:55: error: template placeholder type 'const common_iterator<...auto...>' must be followed by a simple declarator-id
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:654:53: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
654 | noexcept(noexcept(ranges::iter_move(declval<const I&>())))
| ^
p998.cpp:654:53: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:654:53: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:654:53: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:654:53: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:654:47: error: expected primary-expression before 'const'
654 | noexcept(noexcept(ranges::iter_move(declval<const I&>())))
| ^~~~~
p998.cpp:655:29: error: 'I' was not declared in this scope
655 | requires input_iterator<I>;
| ^
p998.cpp:655:14: error: template argument 1 is invalid
655 | requires input_iterator<I>;
| ^~~~~~~~~~~~~~~~~
p998.cpp:653:45: error: constraints on a non-templated function
653 | friend constexpr iter_rvalue_reference_t<I> iter_move(const common_iterator& i)
| ^~~~~~~~~
p998.cpp:658:31: error: 'I' was not declared in this scope
658 | template<indirectly_swappable<I> I2, class S2>
| ^
p998.cpp:658:10: error: template argument 2 is invalid
658 | template<indirectly_swappable<I> I2, class S2>
| ^~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:659:3: error: 'friend' used outside of class
659 | friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
| ^~~~~~
| ------
p998.cpp:659:35: error: template placeholder type 'const common_iterator<...auto...>' must be followed by a simple declarator-id
659 | friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:1834:9: note: 'template<class _It, class _Sent> requires (input_or_output_iterator<_It>) && (sentinel_for<_Sent, _It>) && (!(same_as<_It, _Sent>) && (copyable<_It>)) class std::common_iterator' declared here
1834 | class common_iterator
| ^~~~~~~~~~~~~~~
p998.cpp:659:59: error: expected ')' before ',' token
659 | friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
| ~ ^
| )
p998.cpp:659:59: error: expected ';' before ',' token
659 | friend constexpr void iter_swap(const common_iterator& x, const common_iterator<I2, S2>& y)
| ^
| ;
p998.cpp:661:1: error: expected unqualified-id before 'noexcept'
661 | noexcept(noexcept(ranges::iter_swap(declval<const I&>(), declval<const I2&>())));
| ^~~~~~~~
p998.cpp:665:10: error: redefinition of 'struct std::default_sentinel_t'
665 | struct default_sentinel_t { };
| ^~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:927:10: note: previous definition of 'struct std::default_sentinel_t'
927 | struct default_sentinel_t { };
| ^~~~~~~~~~~~~~~~~~
p998.cpp:672:1: error: 'list' does not name a type
672 | list<string> s;
| ^~~~
p998.cpp:676:13: error: expected constructor, destructor, or type conversion before '(' token
676 | ranges::copy(counted_iterator(s.begin(), 10), default_sentinel, back_inserter(v));
| ^
p998.cpp:680:11: error: redefinition of 'class std::counted_iterator<_It>'
680 | class counted_iterator {
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: previous definition of 'class std::counted_iterator<_It>'
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:754:18: error: there are no arguments to 'ITER_TRAITS' that depend on a template parameter, so a declaration of 'ITER_TRAITS' must be available [-fpermissive]
754 | requires same_as<ITER_TRAITS (I), iterator_traits<I>>
| ^~~~~~~~~~~
p998.cpp:754:18: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
p998.cpp:754:10: error: parse error in template argument list
754 | requires same_as<ITER_TRAITS (I), iterator_traits<I>>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:754:10: error: template argument 1 is invalid
p998.cpp:758:4: error: expected declaration before '}' token
758 | }; }
| ^
p998.cpp:760:32: error: expected ')' before 'i'
760 | constexpr counted_iterator(I i, iter_difference_t<I> n);
| ~ ^~
| )
p998.cpp:764:38: error: 'I' was not declared in this scope; did you mean 'I2'?
764 | requires convertible_to<const I2&, I>
| ^
| I2
p998.cpp:764:12: error: template argument 2 is invalid
764 | requires convertible_to<const I2&, I>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:765:1: error: 'decl-specifier' in declaration of deduction guide
765 | constexpr counted_iterator(const counted_iterator<I2>& x);
| ^~~~~~~~~
p998.cpp:765:11: error: deduction guide for 'std::counted_iterator<_It>' must have trailing return type
765 | constexpr counted_iterator(const counted_iterator<I2>& x);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:768:28: error: 'I' was not declared in this scope; did you mean 'I2'?
768 | requires assignable_from<I&, const I2&>
| ^
| I2
p998.cpp:768:12: error: parse error in template argument list
768 | requires assignable_from<I&, const I2&>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:768:12: error: template argument 1 is invalid
p998.cpp:769:15: error: deduced class type 'counted_iterator' in function return type
769 | constexpr counted_iterator& operator=(const counted_iterator<I2>& x);
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:772:17: error: 'I' does not name a type
772 | constexpr const I& base() const & noexcept;
| ^
p998.cpp:775:29: error: 'I' was not declared in this scope
775 | constexpr iter_difference_t<I> count() const noexcept;
| ^
p998.cpp:775:30: error: template argument 1 is invalid
775 | constexpr iter_difference_t<I> count() const noexcept;
| ^
p998.cpp:775:46: error: non-member function 'constexpr int count()' cannot have cv-qualifier
775 | constexpr iter_difference_t<I> count() const noexcept;
| ^~~~~~~~
p998.cpp:778:26: error: 'constexpr decltype(auto) operator*()' must have an argument of class or enumerated type
778 | constexpr decltype(auto) operator*();
| ^~~~~~~~
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:780:32: error: ISO C++ forbids declaration of 'type name' with no type [-fpermissive]
p998.cpp:780:10: error: 'dereferenceable' was not declared in this scope
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^~~~~~~~~~~~~~~
p998.cpp:780:1: error: expression must be enclosed in parentheses
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^~~~~~~~
p998.cpp:780:10: error: expected initializer before 'dereferenceable'
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^~~~~~~~~~~~~~~
p998.cpp:780:49: error: found ':' in nested-name-specifier, expected '::'
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^
| ::
p998.cpp:780:36: error: 'Preconditions' does not name a type
780 | requires dereferenceable<const I>; Preconditions: length > 0 is true. Effects: Equivalent to: return *current;
| ^~~~~~~~~~~~~
p998.cpp:782:32: error: 'I' was not declared in this scope
782 | requires contiguous_iterator<I>;
| ^
p998.cpp:782:12: error: template argument 1 is invalid
782 | requires contiguous_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~
p998.cpp:781:16: error: constraints on a non-templated function
781 | constexpr auto operator->() const noexcept
| ^~~~~~~~
p998.cpp:782:12: error: non-member function 'constexpr auto operator->()' cannot have cv-qualifier
782 | requires contiguous_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~
p998.cpp:781:16: error: 'constexpr auto operator->()' must be a non-static member function
781 | constexpr auto operator->() const noexcept
| ^~~~~~~~
p998.cpp:784:3: error: expected unqualified-id before 'requires'
784 | requires random_access_iterator<I>;
| ^~~~~~~~
p998.cpp:788:11: error: deduced class type 'counted_iterator' in function return type
788 | constexpr counted_iterator& operator++();
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:790:3: error: expected unqualified-id before '++' token
790 | ++current;
| ^~
p998.cpp:791:3: error: expected unqualified-id before '--' token
791 | --length;
| ^~
p998.cpp:792:3: error: expected unqualified-id before 'return'
792 | return *this;
| ^~~~~~
p998.cpp:793:26: error: 'constexpr decltype(auto) operator++(int)' must have an argument of class or enumerated type
793 | constexpr decltype(auto) operator++(int);
| ^~~~~~~~
p998.cpp:795:1: error: expected unqualified-id before '--' token
795 | --length;
| ^~
p998.cpp:796:8: error: expected unqualified-id before 'try'
796 | try { return current++; }
| ^~~
p998.cpp:797:8: error: expected unqualified-id before 'catch'
797 | catch(...) { ++length; throw; }
| ^~~~~
p998.cpp:799:29: error: 'I' was not declared in this scope
799 | requires forward_iterator<I>;
| ^
p998.cpp:799:12: error: template argument 1 is invalid
799 | requires forward_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~
p998.cpp:798:11: error: deduced class type 'counted_iterator' in function return type
798 | constexpr counted_iterator operator++(int)
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:801:32: error: invalid use of 'this' at top level
801 | counted_iterator tmp = *this;
| ^~~~
p998.cpp:802:8: error: expected unqualified-id before '++' token
802 | ++*this;
| ^~
p998.cpp:803:8: error: expected unqualified-id before 'return'
803 | return tmp;
| ^~~~~~
p998.cpp:805:37: error: 'I' was not declared in this scope
805 | requires bidirectional_iterator<I>;
| ^
p998.cpp:805:14: error: template argument 1 is invalid
805 | requires bidirectional_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:804:13: error: deduced class type 'counted_iterator' in function return type
804 | constexpr counted_iterator& operator--()
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:807:8: error: expected unqualified-id before '--' token
807 | --current;
| ^~
p998.cpp:808:8: error: expected unqualified-id before '++' token
808 | ++length;
| ^~
p998.cpp:809:8: error: expected unqualified-id before 'return'
809 | return *this;
| ^~~~~~
p998.cpp:811:37: error: 'I' was not declared in this scope
811 | requires bidirectional_iterator<I>;
| ^
p998.cpp:811:14: error: template argument 1 is invalid
811 | requires bidirectional_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:810:13: error: deduced class type 'counted_iterator' in function return type
810 | constexpr counted_iterator operator--(int)
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:813:32: error: invalid use of 'this' at top level
813 | counted_iterator tmp = *this;
| ^~~~
p998.cpp:814:8: error: expected unqualified-id before '--' token
814 | --*this;
| ^~
p998.cpp:815:8: error: expected unqualified-id before 'return'
815 | return tmp;
| ^~~~~~
p998.cpp:816:58: error: 'I' was not declared in this scope
816 | constexpr counted_iterator operator+(iter_difference_t<I> n) const
| ^
p998.cpp:816:59: error: template argument 1 is invalid
816 | constexpr counted_iterator operator+(iter_difference_t<I> n) const
| ^
p998.cpp:817:37: error: 'I' was not declared in this scope
817 | requires random_access_iterator<I>;
| ^
p998.cpp:817:14: error: template argument 1 is invalid
817 | requires random_access_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:816:13: error: deduced class type 'counted_iterator' in function return type
816 | constexpr counted_iterator operator+(iter_difference_t<I> n) const
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:819:1: error: 'friend' used outside of class
819 | friend constexpr counted_iterator operator+(
| ^~~~~~
| ------
p998.cpp:820:21: error: 'I' was not declared in this scope
820 | iter_difference_t<I> n, const counted_iterator& x)
| ^
p998.cpp:820:22: error: template argument 1 is invalid
820 | iter_difference_t<I> n, const counted_iterator& x)
| ^
p998.cpp:820:27: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
820 | iter_difference_t<I> n, const counted_iterator& x)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:821:35: error: 'I' was not declared in this scope
821 | requires random_access_iterator<I>;
| ^
p998.cpp:821:12: error: template argument 1 is invalid
821 | requires random_access_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:819:18: error: deduced class type 'counted_iterator' in function return type
819 | friend constexpr counted_iterator operator+(
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:823:58: error: 'I' was not declared in this scope
823 | constexpr counted_iterator& operator+=(iter_difference_t<I> n)
| ^
p998.cpp:823:59: error: template argument 1 is invalid
823 | constexpr counted_iterator& operator+=(iter_difference_t<I> n)
| ^
p998.cpp:824:35: error: 'I' was not declared in this scope
824 | requires random_access_iterator<I>;
| ^
p998.cpp:824:12: error: template argument 1 is invalid
824 | requires random_access_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:823:11: error: deduced class type 'counted_iterator' in function return type
823 | constexpr counted_iterator& operator+=(iter_difference_t<I> n)
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:826:6: error: 'current' does not name a type
826 | current += n;
| ^~~~~~~
p998.cpp:827:6: error: 'length' does not name a type
827 | length -= n;
| ^~~~~~
p998.cpp:828:6: error: expected unqualified-id before 'return'
828 | return *this;
| ^~~~~~
p998.cpp:829:56: error: 'I' was not declared in this scope
829 | constexpr counted_iterator operator-(iter_difference_t<I> n) const
| ^
p998.cpp:829:57: error: template argument 1 is invalid
829 | constexpr counted_iterator operator-(iter_difference_t<I> n) const
| ^
p998.cpp:830:35: error: 'I' was not declared in this scope
830 | requires random_access_iterator<I>;
| ^
p998.cpp:830:12: error: template argument 1 is invalid
830 | requires random_access_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:829:11: error: deduced class type 'counted_iterator' in function return type
829 | constexpr counted_iterator operator-(iter_difference_t<I> n) const
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:832:22: error: 'I' was not declared in this scope
832 | template<common_with<I> I2>
| ^
p998.cpp:832:10: error: template argument 2 is invalid
832 | template<common_with<I> I2>
| ^~~~~~~~~~~~~~
p998.cpp:833:3: error: 'friend' used outside of class
833 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~
| ------
p998.cpp:833:38: error: 'I2' was not declared in this scope
833 | friend constexpr iter_difference_t<I2> operator-(
| ^~
p998.cpp:833:40: error: template argument 1 is invalid
833 | friend constexpr iter_difference_t<I2> operator-(
| ^
p998.cpp:834:1: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
834 | const counted_iterator& x, const counted_iterator<I2>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:834:26: error: expected ')' before ',' token
834 | const counted_iterator& x, const counted_iterator<I2>& y);
| ^
| )
p998.cpp:833:51: note: to match this '('
833 | friend constexpr iter_difference_t<I2> operator-(
| ^
p998.cpp:833:42: error: 'constexpr int operator-(...)' must have an argument of class or enumerated type
833 | friend constexpr iter_difference_t<I2> operator-(
| ^~~~~~~~
p998.cpp:836:1: error: 'friend' used outside of class
836 | friend constexpr iter_difference_t<I> operator-(
| ^~~~~~
| ------
p998.cpp:836:36: error: 'I' was not declared in this scope
836 | friend constexpr iter_difference_t<I> operator-(
| ^
p998.cpp:836:37: error: template argument 1 is invalid
836 | friend constexpr iter_difference_t<I> operator-(
| ^
p998.cpp:837:3: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
837 | const counted_iterator& x, default_sentinel_t);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:837:28: error: expected ')' before ',' token
837 | const counted_iterator& x, default_sentinel_t);
| ^
| )
p998.cpp:836:48: note: to match this '('
836 | friend constexpr iter_difference_t<I> operator-(
| ^
p998.cpp:836:39: error: 'constexpr int operator-(...)' must have an argument of class or enumerated type
836 | friend constexpr iter_difference_t<I> operator-(
| ^~~~~~~~
p998.cpp:837:48: error: expected initializer before ')' token
837 | const counted_iterator& x, default_sentinel_t);
| ^
p998.cpp:839:21: error: expected unqualified-id before ',' token
839 | default_sentinel_t, const counted_iterator& y);
| ^
p998.cpp:839:23: error: expected unqualified-id before 'const'
839 | default_sentinel_t, const counted_iterator& y);
| ^~~~~
p998.cpp:841:58: error: 'I' was not declared in this scope
841 | constexpr counted_iterator& operator-=(iter_difference_t<I> n)
| ^
p998.cpp:841:59: error: template argument 1 is invalid
841 | constexpr counted_iterator& operator-=(iter_difference_t<I> n)
| ^
p998.cpp:842:35: error: 'I' was not declared in this scope
842 | requires random_access_iterator<I>;
| ^
p998.cpp:842:12: error: template argument 1 is invalid
842 | requires random_access_iterator<I>;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:841:11: error: deduced class type 'counted_iterator' in function return type
841 | constexpr counted_iterator& operator-=(iter_difference_t<I> n)
| ^~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:844:8: error: 'current' does not name a type
844 | current -= n;
| ^~~~~~~
p998.cpp:845:8: error: 'length' does not name a type
845 | length += n;
| ^~~~~~
p998.cpp:846:8: error: expected unqualified-id before 'return'
846 | return *this;
| ^~~~~~
p998.cpp:848:22: error: 'I' was not declared in this scope
848 | template<common_with<I> I2>
| ^
p998.cpp:848:10: error: template argument 2 is invalid
848 | template<common_with<I> I2>
| ^~~~~~~~~~~~~~
p998.cpp:849:3: error: 'friend' used outside of class
849 | friend constexpr bool operator==(
| ^~~~~~
| ------
p998.cpp:850:1: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
850 | const counted_iterator& x, const counted_iterator<I2>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:850:26: error: expected ')' before ',' token
850 | const counted_iterator& x, const counted_iterator<I2>& y);
| ^
| )
p998.cpp:849:35: note: to match this '('
849 | friend constexpr bool operator==(
| ^
p998.cpp:849:25: error: 'constexpr bool operator==(...)' must have an argument of class or enumerated type
849 | friend constexpr bool operator==(
| ^~~~~~~~
p998.cpp:852:1: error: 'friend' used outside of class
852 | friend constexpr bool operator==(
| ^~~~~~
| ------
p998.cpp:853:3: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
853 | const counted_iterator& x, default_sentinel_t);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:853:28: error: expected ')' before ',' token
853 | const counted_iterator& x, default_sentinel_t);
| ^
| )
p998.cpp:852:33: note: to match this '('
852 | friend constexpr bool operator==(
| ^
p998.cpp:852:23: error: 'constexpr bool operator==(...)' must have an argument of class or enumerated type
852 | friend constexpr bool operator==(
| ^~~~~~~~
p998.cpp:853:48: error: expected initializer before ')' token
853 | const counted_iterator& x, default_sentinel_t);
| ^
p998.cpp:855:22: error: 'I' was not declared in this scope
855 | template<common_with<I> I2>
| ^
p998.cpp:855:10: error: template argument 2 is invalid
855 | template<common_with<I> I2>
| ^~~~~~~~~~~~~~
p998.cpp:856:3: error: 'friend' used outside of class
856 | friend constexpr strong_ordering operator<=>(
| ^~~~~~
| ------
p998.cpp:857:1: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
857 | const counted_iterator& x, const counted_iterator<I2>& y);
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:857:26: error: expected ')' before ',' token
857 | const counted_iterator& x, const counted_iterator<I2>& y);
| ^
| )
p998.cpp:856:47: note: to match this '('
856 | friend constexpr strong_ordering operator<=>(
| ^
p998.cpp:856:36: error: 'constexpr std::strong_ordering operator<=>(...)' must have an argument of class or enumerated type
856 | friend constexpr strong_ordering operator<=>(
| ^~~~~~~~
p998.cpp:861:1: error: 'friend' used outside of class
861 | friend constexpr iter_rvalue_reference_t<I>
| ^~~~~~
| ------
p998.cpp:861:42: error: 'I' was not declared in this scope
861 | friend constexpr iter_rvalue_reference_t<I>
| ^
p998.cpp:861:43: error: template argument 1 is invalid
861 | friend constexpr iter_rvalue_reference_t<I>
| ^
p998.cpp:862:13: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
862 | iter_move(const counted_iterator& i)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:863:37: error: 'i' was not declared in this scope
863 | noexcept(noexcept(ranges::iter_move(i.current)))
| ^
p998.cpp:864:25: error: 'I' was not declared in this scope
864 | requires input_iterator<I>;
| ^
p998.cpp:864:10: error: template argument 1 is invalid
864 | requires input_iterator<I>;
| ^~~~~~~~~~~~~~~~~
p998.cpp:862:3: error: constraints on a non-templated function
862 | iter_move(const counted_iterator& i)
| ^~~~~~~~~
p998.cpp:867:31: error: 'I' was not declared in this scope
867 | template<indirectly_swappable<I> I2>
| ^
p998.cpp:867:10: error: template argument 2 is invalid
867 | template<indirectly_swappable<I> I2>
| ^~~~~~~~~~~~~~~~~~~~~~~
p998.cpp:868:3: error: 'friend' used outside of class
868 | friend constexpr void
| ^~~~~~
| ------
p998.cpp:869:15: error: template placeholder type 'const counted_iterator<...auto...>' must be followed by a simple declarator-id
869 | iter_swap(const counted_iterator& x, const counted_iterator<I2>& y)
| ^~~~~
/usr/local/include/c++/12.1.0/bits/stl_iterator.h:2259:11: note: 'template<class _It> requires input_or_output_iterator<_It> class std::counted_iterator' declared here
2259 | class counted_iterator
| ^~~~~~~~~~~~~~~~
p998.cpp:869:40: error: expected ')' before ',' token
869 | iter_swap(const counted_iterator& x, const counted_iterator<I2>& y)
| ~ ^
| )
p998.cpp:869:40: error: expected ';' before ',' token
869 | iter_swap(const counted_iterator& x, const counted_iterator<I2>& y)
| ^
| ;
p998.cpp:879:12: error: redefinition of 'struct std::unreachable_sentinel_t'
879 | struct unreachable_sentinel_t {
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/c++/12.1.0/bits/iterator_concepts.h:917:10: note: previous definition of 'struct std::unreachable_sentinel_t'
917 | struct unreachable_sentinel_t
| ^~~~~~~~~~~~~~~~~~~~~~
検討事項(agenda)
コンパイルエラーを取るか、コンパイルエラーの理由を解説する。
参考資料(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 使ってみた
DoCAP(ドゥーキャップ)って何ですか?
小川メソッド 覚え(書きかけ)
<この記事は個人の過去の経験に基づく個人の感想です。現在所属する組織、業務とは関係がありません。>
文書履歴(document history)
ver. 0.01 初稿 20220809