0

Ranges are complete in VS2019, see https://devblogs.microsoft.com/cppblog/c20-ranges-are-complete-in-visual-studio-2019-version-16-10/

Why does the output_iterator concept have a static cast in the definition below taken from the Microsoft implementation?

// CONCEPT output_iterator
template <class _It, class _Ty>
concept output_iterator = input_or_output_iterator<_It> && indirectly_writable<_It, _Ty>
    && requires(_It __i, _Ty&& __t) {
        *__i++ = static_cast<_Ty&&>(__t);
    };

The definition on cppreference contains no such cast. enter image description here

René Hiemstra
  • 117
  • 1
  • 4
  • 1
    `static_cast` here is equivalent to `std::forward`. [This answer](https://stackoverflow.com/questions/53257824/why-use-stdforwardt-instead-of-static-castt) might help – ph3rin Jun 13 '21 at 22:26
  • That clears things up, thanks. It seems though that this concept constraint may lead to unwanted type conversions. If `It` is an iterator with value type double then `std::output_iterator`, `std::output_iterator` and `std::output_iterator` are all true. – René Hiemstra Jun 14 '21 at 15:15

0 Answers0