concatenate stringstream in c++

后端 未结 6 472
没有蜡笔的小新
没有蜡笔的小新 2021-01-17 16:20

How can I concatenate two stringstreams?

#include 
#include 
#include 
#include 
#include <         


        
6条回答
  •  爱一瞬间的悲伤
    2021-01-17 17:00

    You don't need two instance of std::stringstream. One is enough for the purpose.

    std::stringstream a;
    a << source << dest;
    
    std::string s = a.str(); //get the underlying string
    

提交回复
热议问题