How to force std::stringstream operator >> to read an entire string?
问题 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 from a text file: template <typename T> class ValueContainer { protected: T m_value; public: /* ... */ virtual void fromString(std::string & str) { std::stringstream ss; ss << str; ss >> m_value; } /* ... */ }; I've tried setting/unsetting stream flags but it didn't help. Clarification The class is a container template with