nholthaus / units

a compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies.
http://nholthaus.github.io/units/
MIT License
947 stars 135 forks source link

Unit container conversion without using namespace #195

Open jhonathanzentech opened 5 years ago

jhonathanzentech commented 5 years ago

I am trying to perform an unit container conversion like this:

units::length::meter_t a(1.0);
units::length::mile_t b = a;
std::cout << b << std::endl;

This should print 0.000621371 mi but instead it prints 1 m.

If I do this:

using namespace units;
using namespace units::length;
meter_t a(1.0);
mile_t b = a;
std::cout << b << std::endl;

Now it does print 0.000621371 mi. Is there any reason for this?

JohelEGP commented 5 years ago

Seems like #146 and this were fixed by #167, so in the v3.x branch the output is as expected.