AMDG On 1/14/19 1:50 AM, Carel Combrink via Boost-users wrote:
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
; using Kilohertz = boost::units::quantity ; Assigning one type to another does not compile: Kilohertz freqKhz = Kilohertz::from_value( 1.234 ); Hertz freqHz = freqKhz;
This is not assignment. It uses the copy constructor and requires an implicit conversion (which is forbidden by design). Try direct construction, instead: Hertz freqHz{freqKhz};
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) <snip>
In Christ, Steven Watanabe