word list from cin?

How to read in a list of words from cin (using whitespace
as separator is ok)?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
list<string> readStrings()
{
   list<string> ret;
   while (true)
   {
      string s;
      cin >> s;
      cout << " <" << s << "> ";
      if (s == ".")
      {
         return ret;
      }
      ret.push_back(s);
   }
}


This function is just making fun of me: in one application
it works ok, but in another it magically needs TWO '.' just
to return!
My misunderstanding, sorry.
Topic archived. No new replies allowed.