1

This is a question regarding an answer found here.

The following tokenizes a string:

string sentence = "And I feel fine...";
istringstream iss(sentence);
vector<string> tokens{istream_iterator<string>{iss},
                      istream_iterator<string>{}};

What does the last line mean? What is the purpose of the {}.

drum
  • 5,416
  • 7
  • 57
  • 91
  • 1
    [Default constructed input stream iterator](http://en.cppreference.com/w/cpp/iterator/istream_iterator/istream_iterator) using uniform initialization. The same as `istream_iterator()`. Good discussion of Uniform Initialization: https://stackoverflow.com/questions/24953658/what-are-the-differences-between-c-like-constructor-and-uniform-initialization – user4581301 Jul 26 '17 at 04:03
  • @user4581301 Very informative. I really need to get with the times. Thank you. – drum Jul 26 '17 at 04:18
  • 1
    Your question title doesn't really have much to do with what you're actually asking about... I came here looking for how to tokenize using an `istream_iterator` and found a question about uniform initialization instead, lol – Alexandre Mar 17 '21 at 03:34

0 Answers0