[Boost-bugs] [Boost C++ Libraries] #7138: Output of a UDT with autoprefix requires specialization of auto_prefix_norm

Subject: [Boost-bugs] [Boost C++ Libraries] #7138: Output of a UDT with autoprefix requires specialization of auto_prefix_norm
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-07-16 08:42:29


#7138: Output of a UDT with autoprefix requires specialization of
auto_prefix_norm
----------------------------------+-----------------------------------------
 Reporter: pbristow | Owner: steven_watanabe
     Type: Bugs | Status: new
Milestone: Boost 1.51.0 | Component: units
  Version: Boost 1.51.0 | Severity: Problem
 Keywords: units autoprefix UDT |
----------------------------------+-----------------------------------------
 Output of a UDT with autoprefix requires specialization of
 auto_prefix_norm for the scaling to take place. For example, to get
 expected scaling to kilometers from

 quantity<length, measurement<double> >
 biglen(measurement<double>(12345.0,123.0)*meters); autoscaled =
 12.345(+/-0.123) km

 This can be achieved by adding this to measurement.hpp (where Y is the
 type of UDT)


 {{{
 // Specialization of autoprefix_norm for UDTboost::units::measurement<Y>
 // See io.hpp.
 // This specialization is required to get autoprefix to work with this
 class.

 template<class Y>
 typename autoprefix_norm_impl<boost::units::measurement<Y>, true>::type
 autoprefix_norm(const boost::units::measurement<Y> & arg)
 {
   return autoprefix_norm_impl<Y, true>::call(arg);
 }
 }}}
 However this assumes that the class Y is convertible to double.
 autoprefix_norm_impl<T, true>::type appears to be always double.
 I am unclear if this is checked or is the responsibility or the user?

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7138>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:10 UTC