Error: cannot pass objects of non-trivially copied type through `...`

I have a unit class that has properties

 std::is_trivial<unit>::value; // true std::is_trivially_copyable<unit>::value; // true (on compilers which have this trait) 

I would like to pass unit vectors as a tuple, for example

 using geodeticTuple = std::tuple<unit, unit, unit>; 

I need these vectors to go into conversion functions that use different types of arguments, for example.

someOtherType convert(const geodeticTuple& point, const geodeticTuple& origin) or

someOtherType convert(const geodeticTuple& point, ...)

using MSVC2015, this works fine, but with gcc-4.9.3 I get an error:

error: cannot pass objects with a nontrivially copied type const geodeticTuple {aka const struct std::tuple<unit, unit, unit>} via ...

and since gcc-4.9.3 does not support styles like is_trivially_xxx style, I am having trouble understanding why this is happening.

Is a tuple of trivial types that cannot be trivially copied?

0
c ++ c ++ 11 tuples typetraits stdtuple
source share
1 answer
The copy / move assignment operators require special handling of reference types, so they should be provided by the user in the general case.

Since the standard does not require a trivial ability to copy, this is a QoI problem if developers switch to an additional length of this guarantee (which will require the addition of additional specializations).

+1
source share

All Articles