On Thursday 17 September 2009 11:02:47 am Steven Watanabe wrote:
In this case it's probably easier to define a new base unit and use the conversion macros, which can accept a double. (Warning untested)
struct electron_volt_base_unit : base_unit
{ static const char* name() { return "electron-Volt"; } static const char* symbol() { return "eV"; } }; BOOST_UNITS_DEFINE_CONVERSION_FACTOR(electron_volt_base_unit, si::energy, double, 1.602e-19); BOOST_UNITS_DEFAULT_CONVERSION(electron_volt_base_unit, si::energy);
I though base-units were restricted to fundamental dimensions length, mass, time etc. This example works but doesn't this concept clash with what is mentioned in http://www.boost.org/doc/libs/1_40_0/doc/html/boost_units/Units.html#boost_u... Thanks, Manoj