Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/134.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 获取类似streamstring的函数参数_C++ - Fatal编程技术网

C++ 获取类似streamstring的函数参数

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

我想得到streamstring这样的函数参数

//宣布 foo(std::stringstream strString)

//使用
foo(“Hello”你可以用宏来做这件事-看看这个答案

首先,你必须得到奇怪的字符串连接(?)
“Hello”
struct Example
{
    Example& operator<<(int i) 
    {
        /* use i */ 
        return *this; 
    }
};

Example e;
e << 42; // calls operator<< overload