I have conversions working fine for built-in types, but for both
scaled types and user-defined types I don't know how to get indirect
conversions to compile.
Here is an example:
#include
#include
#include
#include
void f() {
typedef metric::bar_base_unit::unit_type bars;
typedef boost::units::scale<10,static_rational<3> > kilo_type;
typedef make_scaled_unit::type kbars;
const kbars kilobars;
typedef boost::units::scale<10,static_rational<6> > mega_type;
typedef make_scaled_unitsi::pressure,mega_type::type mpa;
const mpa megapascals;
typedef boost::units::quantitysi::pressure Pascals;
typedef boost::units::quantity<mpa> Megapascals;
typedef boost::units::quantity<kbars> Kilobars;
Megapascals p(.5*kilobars);
std::cout << Kilobars(p) << std::endl;
}
If I directly convert it works - e.g., Kilobars(Pascals(p)). Do I
need to use BOOST_UNITS_DEFAULT_CONVERSION to set a default
conversion? If so - which part(s) of the chain need it?
Justin