Search Results

Search found 1 results on 1 pages for 'stumped6789'.

Page 1/1 | 1 

  • Why can't I construct an std::istream_iterator with an unnamed temporary?

    - by Stumped6789
    g++ allows this construction of an istream_iterator from an ifstream instance: std::ifstream ifstr("test.txt"); std::istream_iterator<std::string> iter1(ifstr); ...but it doesn't allow the same construction with an unnamed temporary: std::istream_iterator<std::string> iter2(std::ifstream("test.txt")); This gives: error: no matching function for call to ‘std::istream_iterator, ptrdiff_t::istream_iterator(std::ifstream)’ Does anyone know why this doesn't work? - thanks!

    Read the article

1