Re: How to terminate cin?
The default constructor of istream_iterator constructs an iterator that represents past-the-end. The first iterator will only be equal to the past-the-end one (and therefore input will only terminate) if something causes the eofbit or failbit of the stream passed as an argument (in your case, cin), to be set. So one way of terminating input is simulating the end-of-file character from the keyboard, usually done with Ctrl+Z.
I'm not sure if you have any choice other than a default-constructed istream_iterator object as the second argument to copy() in a case like this.