Converting strstream to sstream conflict about c_str()

后端 未结 2 1394
执念已碎
执念已碎 2021-01-26 13:53

I have this code block as written with strstream. And I converted it to sstream as below. I\'m not sure, but I think printStream->str()

相关标签:
2条回答
  • 2021-01-26 14:18

    Change the return type to std::string and return a std::string object directly.

    0 讨论(0)
  • 2021-01-26 14:31

    I think a function called to_string really, really, really should return a std::string.

    And then all this junk can be replaced by

    std::string FieldData::to_string() const
    { return "Invalid Field Type"; }
    
    0 讨论(0)
提交回复
热议问题