Fix constructor declarations that are invalid in C++20 onwards.

Under C++ CWG DR 2237, the constructor for a class template C must be
written as 'C(...)' not as 'C<T>(...)'. This fixes a build failure with
GCC in C++20 mode.

In passing, remove some other redundant '<T>' qualification from the
affected classes.
This commit is contained in:
Richard Smith 2021-02-23 14:07:13 -08:00
parent c7d46f221e
commit 95d0d8e9e9
1 changed files with 6 additions and 6 deletions

View File

@ -1820,9 +1820,9 @@ template <typename R> struct result_pair {
result_pair(std::size_t Index, IterOfRange<R> Iter) result_pair(std::size_t Index, IterOfRange<R> Iter)
: Index(Index), Iter(Iter) {} : Index(Index), Iter(Iter) {}
result_pair<R>(const result_pair<R> &Other) result_pair(const result_pair<R> &Other)
: Index(Other.Index), Iter(Other.Iter) {} : Index(Other.Index), Iter(Other.Iter) {}
result_pair<R> &operator=(const result_pair<R> &Other) { result_pair &operator=(const result_pair &Other) {
Index = Other.Index; Index = Other.Index;
Iter = Other.Iter; Iter = Other.Iter;
return *this; return *this;
@ -1856,22 +1856,22 @@ public:
result_type &operator*() { return Result; } result_type &operator*() { return Result; }
const result_type &operator*() const { return Result; } const result_type &operator*() const { return Result; }
enumerator_iter<R> &operator++() { enumerator_iter &operator++() {
assert(Result.Index != std::numeric_limits<size_t>::max()); assert(Result.Index != std::numeric_limits<size_t>::max());
++Result.Iter; ++Result.Iter;
++Result.Index; ++Result.Index;
return *this; return *this;
} }
bool operator==(const enumerator_iter<R> &RHS) const { bool operator==(const enumerator_iter &RHS) const {
// Don't compare indices here, only iterators. It's possible for an end // Don't compare indices here, only iterators. It's possible for an end
// iterator to have different indices depending on whether it was created // iterator to have different indices depending on whether it was created
// by calling std::end() versus incrementing a valid iterator. // by calling std::end() versus incrementing a valid iterator.
return Result.Iter == RHS.Result.Iter; return Result.Iter == RHS.Result.Iter;
} }
enumerator_iter<R>(const enumerator_iter<R> &Other) : Result(Other.Result) {} enumerator_iter(const enumerator_iter &Other) : Result(Other.Result) {}
enumerator_iter<R> &operator=(const enumerator_iter<R> &Other) { enumerator_iter &operator=(const enumerator_iter &Other) {
Result = Other.Result; Result = Other.Result;
return *this; return *this;
} }