我有一个类unit
,其具有的属性错误:无法通过`传递非平凡-复制的类型的对象...`
std::is_trivial<unit>::value; // true
std::is_trivially_copyable<unit>::value; // true (on compilers which have this trait)
我想通过被的unit
矢量作为元组,例如
using geodeticTuple = std::tuple<unit, unit, unit>;
我需要这些向量可以转换为使用不同类型参数的转换函数。
someOtherType convert(const geodeticTuple& point, const geodeticTuple& origin)
或使用MSVC2015
someOtherType convert(const geodeticTuple& point, ...)
,这工作完全正常,但用gcc-4.9.3,我得到的错误:
error: cannot pass objects of non-trivially-copyable type
const geodeticTuple {aka const struct std::tuple<unit, unit, unit>}
through...
而且由于GCC-4.9 .3不支持is_trivially_xxx
风格类型特征,我很难理解为什么这是失败的。
是一个不平凡的类型的元组不平凡复制?
为什么你使用旧式c vararg函数而不是可变参数函数模板? –
我遇到了麻烦,因为当没有参数存在时它似乎不喜欢。 –