Open kunaltyagi opened 4 years ago
In v3 you can specify your own base dimensions arbitrarily, they just need a name and an abbreviation. see here: https://github.com/nholthaus/units/blob/v3.x/include/units/core.h#L1117
On Thu, Sep 12, 2019 at 3:55 AM Kunal Tyagi notifications@github.com wrote:
- Which version of units you are using master or 3 (doesn't matter)
Is there a way to create new base categories like length, temperature? Based on the inheritance diagram of unit<...> it doesn't seem so.
Essentially, I need to create a couple of non-dimensional units (with user defined conversions between them).
Right now, my functions look like
unitA convert(unitB); std::tuple
convert(std::tuple<UnitD, Unit E>); // only a few specializations exist Can I adapt my usage to make better use of this library?
This is related weakly to the broader discussion in #83 https://github.com/nholthaus/units/issues/83
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nholthaus/units/issues/233?email_source=notifications&email_token=ACOYOH64R4ZYXA7XAHD6AIDQJHYX7A5CNFSM4IWAOZOKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HK5FOOA, or mute the thread https://github.com/notifications/unsubscribe-auth/ACOYOHYVHWBQKYYA2NCNBJDQJHYX7ANCNFSM4IWAOZOA .
In v3 you can specify your own base dimensions arbitrarily
Great. So just using myUnit = units::make_dimension<MyUnitTagStruct>;
and with the tag struct requiring only 2 members? Seems awesome. I'll report back on my experiments with v3
So, I've a system working, I don't know how well designed it is. I've copied some from the "show off thread". My system can be found at this gist. Would this be the correct place to ask for feedback?
// My wish: to use the following syntax without using convert function
projections::spherical_projection::theta_t p = 1_x; // compiler fails to find a conversion (ofc)
tan
with my custom theta_t
type which is obviously not an angle type
units
you are using master or 3 (doesn't matter)Is there a way to create new
base categories
likelength
,temperature
? Based on the inheritance diagram ofunit<...>
it doesn't seem so.Essentially, I need to create a couple of non-dimensional units (with user defined conversions between them).
Right now, my functions look like
Can I adapt my usage to make better use of this library?
This is related weakly to the broader discussion in #83