Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/templates/2.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++ C++;模板类构造函数_C++_Templates_Constructor - Fatal编程技术网

C++ C++;模板类构造函数

C++ C++;模板类构造函数,c++,templates,constructor,C++,Templates,Constructor,我有一门课: template<typename T, typename S> class filterable_data { /* ... */ }; 模板 类可过滤数据 { /* ... */ }; 我创建了这两个实例: filterable_data<int, char> a; filterable_data<int, bool> b = a; filterable_数据a; 可过滤数据b=a; 我的问题是,如何正确编写该构造函数?也将其

我有一门课:

template<typename T, typename S>
class filterable_data
{
    /* ... */
};
模板
类可过滤数据
{
/* ... */
};
我创建了这两个实例:

filterable_data<int, char> a;
filterable_data<int, bool> b = a;
filterable_数据a;
可过滤数据b=a;

我的问题是,如何正确编写该构造函数?

也将其作为模板:

template<typename T2, typename S2>
filterable_data(const filterable_data<T2, S2>& other);
模板
可过滤数据(常数可过滤数据和其他);

将其作为模板:

template<typename T2, typename S2>
filterable_data(const filterable_data<T2, S2>& other);
模板
可过滤数据(常数可过滤数据和其他);

将其作为模板:

template<typename T2, typename S2>
filterable_data(const filterable_data<T2, S2>& other);
模板
可过滤数据(常数可过滤数据和其他);

将其作为模板:

template<typename T2, typename S2>
filterable_data(const filterable_data<T2, S2>& other);
模板
可过滤数据(常数可过滤数据和其他);

你尝试了什么,在哪里失败了?你尝试了什么,在哪里失败了?你尝试了什么,在哪里失败了?你尝试了什么,在哪里失败了?它很有用,可能是OP想要的,但它不是复制构造函数。复制构造函数永远不是模板。它很有用,可能是OP想要的,但它不是复制构造函数。复制构造函数永远不是模板。它很有用,可能是OP想要的,但它不是复制构造函数。复制构造函数永远不是模板。它很有用,可能是OP想要的,但它不是复制构造函数。复制构造函数永远不是模板。