Hi.
I have two unit quantities defined as follow:
static const auto Hz = boost::units::si::hertz;
static const auto KHz = boost::units::si::kilo * Hz;
using Hertz = boost::units::quantity
error: conversion from 'Kilohertz {aka boost::units::quantity<...>, double>}' to non-scalar type 'Hertz {aka boost::units::quantity<...>, double>}' requested [1]
Is this possible, should it be enabled or is it not supported? I am using boost 01.67, Mingw 5.3 and MSVC 2017 (C++14) The following options work as expected: Hertz freq1 = static_cast<Hertz>( freqKhz ); Hertz freq2 = Hertz( freqKhz ); But this adds a bit more code to maintain and keep in sync, one thing one tries to avoid when using the library since one needs to keep the LHS and the RHS of the opertor= in sync. PS: The chrono library allows this type of conversion given there is no information lost (but for double as storage types this should not be the case) std::chrono::seconds sec = std::chrono::seconds { 10 }; std::chrono::nanoseconds nsec = sec; [1] https://gcc.godbolt.org/z/0sTHQQ Regards, Carel