繁体   English   中英

在类的成员初始化器列表中初始化std :: tuple

[英]Initialize std::tuple in member initializer list of a class

我有一个元组作为模板类的成员,我想在构造类的实例时初始化std::tuple

template <typename ...Type>
struct Boundary {
    std::tuple<Type...> lower_boundary, upper_boundary;
    Boundary() : lower_boundary(), upper_boudary(){}
}

对于lower_boundaryupper_boundary ,我想将每个元素初始化为numeric_limits<type for that element>::min()max() 有什么办法可以在成员初始化列表中做到这一点? 我知道我可以在构造函数中设置它,我正在寻找其他方法。

怎么样

Boundary()
    : lower_boundary(std::numeric_limits<Type>::min()...),
      upper_boundary(std::numeric_limits<Type>::max()...)
    {}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM