Opened 6 years ago

#12708 new Bugs

Cannot use Boost Units cmath.hpp with custom systems

Reported by: Kamil Rojewski <kamil.rojewski@…> Owned by: Matthias Schabel
Milestone: To Be Determined Component: units
Version: Boost 1.62.0 Severity: Problem
Keywords: Cc:

Description

When creating a new, custom unit sustem in Boost Units using boost::units::make_system, there's an issue when including cmath.hpp:

In file included from boost/boost/units/cmath.hpp:29:
In file included from boost/boost/units/systems/si/plane_angle.hpp:14:
In file included from boost/boost/units/systems/si/base.hpp:20:
In file included from boost/boost/units/base_units/si/meter.hpp:17:
/boost/boost/units/base_unit.hpp:108:9: error: functions that differ only in their return type cannot be overloaded
        check_double_register(const units::base_unit_ordinal<N>&) 
        ^
Common/Units.h:26:15: note: in instantiation of template class 'boost::units::base_unit<VA::Units::SquareBaseUnit, boost::units::list<boost::units::dim<boost::units::length_base_dimension,
      boost::units::static_rational<1, 1> >, boost::units::dimensionless_type>, -9, void>' requested here
            : boost::units::base_unit<SquareBaseUnit, boost::units::length_dimension, -9>
              ^
boost/boost/units/base_unit.hpp:108:9: note: previous declaration is here
        check_double_register(const units::base_unit_ordinal<N>&) 
        ^
boost/boost/units/base_unit.hpp:114:9: error: redefinition of 'boost_units_unit_is_registered'

As you can see, cmath includes the full si system and you cannot make your own after that.

Change History (0)

Note: See TracTickets for help on using tickets.