Trying to learn above topic and some simple code for reading stringstream and fstream directly into vector<string> with or without std::copy is working fine. However when I try to read from std::cin it seems I can't quit the stream, every time I enter some input and press Enter I get another cursor prompt. How do I get out of this loop and print the vector, assuming of course that it's been populated from cin in the meantime?
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <iterator>
#include <vector>
using namespace std;
int main()
{
    //stringstream ss("The quick brown fox jumped over the lazy dog.");
    //fstream file("F:\\test1.txt");
	
    vector<string> col;
    // copy(istream_iterator<string>(ss), istream_iterator<string>(), back_inserter(col));
	// copy(istream_iterator<string>(file), istream_iterator<string>(), back_inserter(col));
    copy(istream_iterator<string>(cin), istream_iterator<string>(), back_inserter(col));


	// vector<string> col((istream_iterator<string>(ss)), istream_iterator<string>());
	// vector<string> col((istream_iterator<string>(file)), istream_iterator<string>());
	// vector<string> col((istream_iterator<string>(cin)), istream_iterator<string>());


    for (auto& elem : col)
    {
        cout<<elem <<"*";
    }
}
ps: how does std::copy working w/o #include<algorithm>?
pps: started from this link: c++ - How can I use std::copy to read directly from a file stream to a container? - Stack Overflow