How to force std::stringstream operator >> to read an entire string?

后端 未结 6 1563
鱼传尺愫
鱼传尺愫 2021-01-05 08:01

How to force std::stringstream operator >> to read an entire string instead of stopping at the first whitespace?

I\'ve got a template class that stores a value read

6条回答
  •  长发绾君心
    2021-01-05 08:18

    There isn't a way with operator>> that I'm aware of excepted writing your own facet (operator>> stop at first character for which isspace(c, getloc()) is true). But there is a getline function in which has the behaviour you want.

提交回复
热议问题