假设我有一个变量类:
WHERE `e`.`lead_id` IN
(select lds.lead_id from mortgage_lead_leads lds
where lds.loan_officer_id=60 ) or `e`.`lead_id` is null
现在我定义一个包含变量的系统类:
class Variable
{
const std::string name;
const double scale;
public:
Variable(const std::string& _name, double _scale) : name(_name), scale(_scale) { }
};
如何定义template<class... T>
class System
{
std::tuple<T...> variables;
public:
System(???) : ??? { }
};
的构造函数,它会以某种方式将其agruments传递给System
来初始化它们?我希望能够写出这样的东西:
variables
答案 0 :(得分:4)
假设派生类中有正确的构造函数:
template<class... T>
class System
{
std::tuple<T...> variables;
public:
System(const T&... t) : variables(t...) { }
};
System<VAR1, VAR2> s({"VAR1", 10}, {"VAR2", 20});