Replies: 1 comment 9 replies
-
|
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have values with specified units coming across the wire. They have a different byte order than my host system. I've created a set of routines to take even non integer values (floats, enums, new type patterned types, and units) and correcty byte swap them to my hosts systems byte order.
This has even worked with with mp_units for the most part. I check using concepts if a type "looks like a mp_unit type" then
byte_swap(x.numerical_value_in(T::reference)) * T:: reference;
. The type that comes out is a byte swapped copy of the type that comes in. This is doubly great because I do not even have to include mp_units to have this template defined.The problem comes when I encounter a quantity point type. There's no numerical value in, and there's no non deprecated way of using
T::reference
. I thought maybe I could use ADL andabsolute<T:: reference>(byte_swap(x.quanity_from_zero(). numerical_value_in(T:: reference)))
but ..absolute
is not a function at all.Now I'm stuck between a rock and a hard place. My code based pre-dates some of these changes, so there's lots of places where this kind of thing used to work, but no longer does. I can't include mp units in the byte swap header, many downstream users do not use mp_units, and it causes compilation issues for their targets.
Is there a way to avoid including mp_units here? I tried to use T::reference * x + T:: point_origin as well , but I guess that wasn't tested on clang or something because it gives incomprehensible errors that don't make any sense.
Beta Was this translation helpful? Give feedback.
All reactions