Questions tagged [std-ranges]

A library for C++20 that introduced std::ranges namespace, which consists of rangified algorithms from header and of range adaptors divided into views and actions.

379 questions
-1
votes
1 answer

C++20 Unable to Satisfy Constraint for ranges::remove_if()

I have the following class: template class Node { private: T item_; public: T Item() const {return item_;} Node(T item) : item_(item) {} Node& operator=(T item) { item_ = item; return *this;} Node&…
Kok How Teh
  • 3,298
  • 6
  • 47
  • 85
-1
votes
2 answers

How to get type of a view?

I want put the definition of a view in a separate compilation unit, but to export the view I need it's type. // .h auto GetView(int index, int size); // .cpp auto GetView(int index, int size) { auto view = ranges::views::ints(-2, 3) |…
Tom Huntington
  • 2,260
  • 10
  • 20
-1
votes
1 answer

Access index of current element in range-for loop c++20

In a pre-c++20 question Access index in range-for loop (answer), it was mentioned that 2020 note: It would probably be more wise to use a lambda-based solution instead of macro trickery. Could someone post the lambda-based solution for c++20? Are…
Tom Huntington
  • 2,260
  • 10
  • 20
-1
votes
1 answer

reference to 'end' is ambiguous when using std ranges

when I try to compile following code: // This file is a "Hello, world!" in C++ language by GCC for wandbox. #include #include #include #include #include #include template struct…
user3520616
  • 60
  • 3
  • 17
1 2 3
25
26