c++ - C++ 中的 (...) 参数是做什么的

标签 c++

我会进入正题,在 thread.h 中,线程的构造函数定义如下。

template<class _Fn,
    class... _Args>
    explicit thread(_Fn&& _Fx, _Args&&... _Ax)
    {   // construct with _Fx(_Ax...)
    _Launch(&_Thr,
         _STD bind(_Decay_copy(_STD forward<_Fn>(_Fx)),
            _Decay_copy(_STD forward<_Args>(_Ax))...));
    }

我想知道...是做什么的 我试过谷歌搜索并查看 stackoverflow,但答案似乎无处可寻! 提前谢谢你:)

最佳答案

这是一个 C++11构造,称为 variadic templates (点击链接)

关于c++ - C++ 中的 (...) 参数是做什么的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24379030/

相关文章:

c++ - 检测静态初始化阶段?

c++ - 具有复杂值类型 : confusion with value_type and reference 的迭代器

c++ - allocate new 零大小数组能有有效值吗?

c++ - 在类成员中初始化变量是不好的做法吗?

c++ - 对成员的 const 引用是否安全

c++ - boost python 导出单例

c++ - 如何将文件内容识别为 ASCII 或二进制

c++ - 如何在共享对象构建中包含子目录

c++ - 如何使用 WriteConsoleInput/WriteConsole 将 Return/Enter 字符发送到控制台

C++ - 参差不齐的 4d 数组