-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!rangesC++20/23 rangesC++20/23 ranges
Description
Non-list-initialization (parentheses) and list-initialization (curly braces) styles are mixed in the <ranges>, however, the latter does not provide any observable benefit and may bring potential issues.
We should use non-list-initialization consistently, as the standard does.
#include <ranges>
#include <initializer_list>
#include <utility>
struct I {
using difference_type = int;
using value_type = int;
I(std::initializer_list<int*>) = delete;
I(int*);
int operator*() const;
I& operator++();
I operator++(int);
};
struct R {
int* begin();
I begin() const;
std::unreachable_sentinel_t end() const;
};
int main() {
auto r = R{} | std::views::transform(std::identity{});
decltype(std::as_const(r).begin()) c = r.begin();
}cpplearner, JMazurkiewicz and fsb4000
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingfixedSomething works now, yay!Something works now, yay!rangesC++20/23 rangesC++20/23 ranges