3

This range-v3 example doesn't compile with Visual C++ version 15.9:

auto letters = ranges::view::iota('a','g');
std::ostringstream out;
out << letters;

Is this by design? What is the way to output ranges to ostringstream?

Barry
  • 286,269
  • 29
  • 621
  • 977
Paul Jurczak
  • 7,008
  • 3
  • 47
  • 72

1 Answers1

2

This program:

#include <iostream>
#include <sstream>
#include <range/v3/view/iota.hpp>

int main() {
    auto letters = ranges::view::iota('a','g');
    std::ostringstream out;
    out << letters;
    std::cout << out.str();
}

works for me with VS 2017 15.9.3 and range-v3 installed by vcpkg. It outputs [a,b,c,d,e,f].

Casey
  • 41,449
  • 7
  • 95
  • 125
  • I just upgraded to 15.9.3 and I had range-v3 also installed with vcpkg, but it still doesn't compile: `error C2440: 'return': cannot convert from 'std::basic_ostream>' to 'Stream &'` – Paul Jurczak Dec 07 '18 at 00:57
  • I tried again on a different PC and this time it works. Maybe one of the recent pull requests changed something. Thanks for checking it out. – Paul Jurczak Dec 07 '18 at 01:40