Subject: [Boost-bugs] [Boost C++ Libraries] #12766: Boost Units: Quantities in Constexpr Functions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-17 10:37:44
#12766: Boost Units: Quantities in Constexpr Functions
-------------------------------------+-----------------------------
Reporter: a.huebl@⦠| Owner: matthiasschabel
Type: Feature Requests | Status: new
Milestone: To Be Determined | Component: units
Version: Boost 1.62.0 | Severity: Problem
Keywords: units literal constexpr |
-------------------------------------+-----------------------------
I would like to use boost quantities in C++11 constexpr functions (and
later C++14 constexpr functions). Unfurtunately, I can not define a simple
quantity as constexpr:
{{{
#include <boost/units/systems/si.hpp>
#include <boost/units/quantity.hpp>
using namespace boost::units;
constexpr quantity< si::length, double > dtestExt{ 0.2e-6 };
// or
constexpr quantity< si::length, double > dtestExt = 0.2e-6;
}}}
g++ -std=c++11 (4.9.4):
{{{
error: the type â
const 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> > > > > >
>
>
>
>
>
>â
of constexpr variable âdtestExtâ is not literal
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/12766> 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:20 UTC