Subject: [Boost-bugs] [Boost C++ Libraries] #6957: Boost.units: static pow<>() fails for quantities with non-double type
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-05-31 19:07:45
#6957: Boost.units: static pow<>() fails for quantities with non-double type
--------------------------------------------------+-------------------------
Reporter: Anna Jaruga <ajaruga@â¦> | Owner: matthiasschabel
Type: Bugs | Status: new
Milestone: To Be Determined | Component: units
Version: Boost 1.48.0 | Severity: Problem
Keywords: units pow |
--------------------------------------------------+-------------------------
Below is a short example depicting that pow<>() works only in the quantity
in the argument has double precision representation. Hope that helps.
ajaruga_at_granda:~/icicle$ cat test.cpp
#include <boost/units/pow.hpp>
#include <boost/units/systems/si.hpp>
using namespace boost::units;
int main() {
quantity<si::length, real_t> a = 1 * si::metres;
quantity<si::volume, real_t> b = pow<3>(a);
}
ajaruga_at_granda:~/icicle$ g++ -Dreal_t=double test.cpp && echo OK
OK
ajaruga_at_granda:~/icicle$ g++ -Dreal_t=float test.cpp && echo OK
test.cpp: In function âint main()â:
test.cpp:7:44: error: conversion from
âboost::units::power_typeof_helper<boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::length_base_dimension,
boost::units::static_rational<1l> >, boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::si::meter_base_unit,
boost::units::list<boost::units::scaled_base_unit<boost::units::cgs::gram_base_unit,
boost::units::scale<10l, boost::units::static_rational<3l> > >,
boost::units::list<boost::units::si::second_base_unit,
boost::units::list<boost::units::si::ampere_base_unit,
boost::units::list<boost::units::si::kelvin_base_unit,
boost::units::list<boost::units::si::mole_base_unit,
boost::units::list<boost::units::si::candela_base_unit,
boost::units::list<boost::units::angle::radian_base_unit,
boost::units::list<boost::units::angle::steradian_base_unit,
boost::units::dimensionless_type> > > > > > > > > > >, float>,
boost::units::static_rational<3l> >::type {aka
boost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::length_base_dimension,
boost::units::static_rational<3l> >, boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::si::meter_base_unit,
boost::units::list<boost::units::scaled_base_unit<boost::units::cgs::gram_base_unit,
boost::units::scale<10l, boost::units::static_rational<3l> > >,
boost::units::list<boost::units::si::second_base_unit,
boost::units::list<boost::units::si::ampere_base_unit,
boost::units::list<boost::units::si::kelvin_base_unit,
boost::units::list<boost::units::si::mole_base_unit,
boost::units::list<boost::units::si::candela_base_unit,
boost::units::list<boost::units::angle::radian_base_unit,
boost::units::list<boost::units::angle::steradian_base_unit,
boost::units::dimensionless_type> > > > > > > > > > >, double>}â to non-
scalar type
âboost::units::quantity<boost::units::unit<boost::units::list<boost::units::dim<boost::units::length_base_dimension,
boost::units::static_rational<3l> >, boost::units::dimensionless_type>,
boost::units::homogeneous_system<boost::units::list<boost::units::si::meter_base_unit,
boost::units::list<boost::units::scaled_base_unit<boost::units::cgs::gram_base_unit,
boost::units::scale<10l, boost::units::static_rational<3l> > >,
boost::units::list<boost::units::si::second_base_unit,
boost::units::list<boost::units::si::ampere_base_unit,
boost::units::list<boost::units::si::kelvin_base_unit,
boost::units::list<boost::units::si::mole_base_unit,
boost::units::list<boost::units::si::candela_base_unit,
boost::units::list<boost::units::angle::radian_base_unit,
boost::units::list<boost::units::angle::steradian_base_unit,
boost::units::dimensionless_type> > > > > > > > > > >, float>â requested
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6957> 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:09 UTC