On 20. Dec 2017, at 05:04, Steven Watanabe via Boost-users
wrote: AMDG
On 12/19/2017 05:38 PM, Santiago Ospina via Boost-users wrote:
I would like to know if there is an equivalent for giving a name and a symbol given a unit in boost::units (maybe scaled from another one).
I know the example of naming base units, however, it would imply I'd have to create a system and a conversion for every unit I want to implement.
I tried to write it directly from the scaled version, like this:
template<> struct scale_minute<60, static_rational<1> > { static const long base = 60; typedef Detail::static_rational<1> exponent; typedef double value_type; static value_type value() { return(60); } static std::string name() { return("minute"); } static std::string symbol() { return("m"); } };
however, it is adding my scaled name plus my base name (say the base name is “s” which stands for seconds, then it would print “m” + "s”).
Any idea how to overcome with that?
try: #include
using minutes = boost::units::metric::minute_base_unit::unit_type; You should be able to use the same method of specializing base_unit_info.
Please notice minute was just a very dumb example to illustrate the idea. Santiago
In Christ, Steven Watanabe _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org mailto:Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users https://lists.boost.org/mailman/listinfo.cgi/boost-users