• Forum
  • Lounge
  • Poor wording in basic_string::getline do

 
Poor wording in basic_string::getline documentation

A user in IRC pointed out some confusing wording related to how the string passed to getline is treated when the string already has contents.

Initially, the documentation says, "Each extracted character is appended to the string as if its member push_back was called." This is correct (to my knowledge). But it forgets an important step. The documentation as is seems to indicate that the string's contents will still be present after getline is called, and the data from getline will only be appended to the string, which is not the case.

The documentation then goes on to document the specific argument, "The contents in the string before the call (if any) are discarded and replaced by the extracted line."

This is accurate. I personally do not like the wording of "replaced" since there is nothing to replace anymore since the contents are discarded.

At this, I think cppreference contains a better description of the function: http://en.cppreference.com/w/cpp/string/basic_string/getline

Thoughts?
closed account (18hRX9L8)
You may have to email him (or report your own post). Or will he just reply here? Curious as to how the updates work.
Last edited on
Just PM twicker with the better wording, and why you think it is so. He'll probably change it before the next day is up.
There is also, the very small "spotted an error" link at the bottom of the page.

HTH
Topic archived. No new replies allowed.