C++ 获取类似streamstring的函数参数
我想得到streamstring这样的函数参数 //宣布 foo(std::stringstream strString) //使用C++ 获取类似streamstring的函数参数,c++,C++,我想得到streamstring这样的函数参数 //宣布 foo(std::stringstream strString) //使用 foo(“Hello”你可以用宏来做这件事-看看这个答案首先,你必须得到奇怪的字符串连接(?)“Hello” struct Example { Example& operator<<(int i) { /* use i */ return *this; } }; Example e
foo(“Hello”你可以用宏来做这件事-看看这个答案首先,你必须得到奇怪的字符串连接(?)
“Hello”
struct Example
{
Example& operator<<(int i)
{
/* use i */
return *this;
}
};
Example e;
e << 42; // calls operator<< overload