我有一個類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函數而不是可變參數函數模板? –
我遇到了麻煩,因爲當沒有參數存在時它似乎不喜歡。 –