Namespaces
Variants
Views
Actions

Talk:cpp/io/basic istream/getline

From cppreference.com
< Talk:cpp‎ | io

it is never explained how the return type of getline (reference to the original stream object) can be used as a condition in a for/while loop. I believe there is a cast to bool defined for the stream which is "false" if the object is in a failed/end state. 128.250.26.7 05:15, 1 November 2013 (PDT)

it is explained in std::basic_ios::operator bool. Same applies to most stream input operations, getline isn't special. It could be helpful to mention that in comments to this page's example, true. (and now it is mentioned) --Cubbi (talk) 06:24, 1 November 2013 (PDT)