update boost on linux
This commit is contained in:
@@ -37,16 +37,16 @@ class absolute
|
||||
typedef absolute<Y> this_type;
|
||||
typedef Y value_type;
|
||||
|
||||
absolute() : val_() { }
|
||||
absolute(const value_type& val) : val_(val) { }
|
||||
absolute(const this_type& source) : val_(source.val_) { }
|
||||
BOOST_CONSTEXPR absolute() : val_() { }
|
||||
BOOST_CONSTEXPR absolute(const value_type& val) : val_(val) { }
|
||||
BOOST_CONSTEXPR absolute(const this_type& source) : val_(source.val_) { }
|
||||
|
||||
this_type& operator=(const this_type& source) { val_ = source.val_; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const this_type& source) { val_ = source.val_; return *this; }
|
||||
|
||||
const value_type& value() const { return val_; }
|
||||
BOOST_CONSTEXPR const value_type& value() const { return val_; }
|
||||
|
||||
const this_type& operator+=(const value_type& val) { val_ += val; return *this; }
|
||||
const this_type& operator-=(const value_type& val) { val_ -= val; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR const this_type& operator+=(const value_type& val) { val_ += val; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR const this_type& operator-=(const value_type& val) { val_ -= val; return *this; }
|
||||
|
||||
private:
|
||||
value_type val_;
|
||||
@@ -54,42 +54,42 @@ class absolute
|
||||
|
||||
/// add a relative value to an absolute one
|
||||
template<class Y>
|
||||
absolute<Y> operator+(const absolute<Y>& aval,const Y& rval)
|
||||
BOOST_CONSTEXPR absolute<Y> operator+(const absolute<Y>& aval,const Y& rval)
|
||||
{
|
||||
return absolute<Y>(aval.value()+rval);
|
||||
}
|
||||
|
||||
/// add a relative value to an absolute one
|
||||
template<class Y>
|
||||
absolute<Y> operator+(const Y& rval,const absolute<Y>& aval)
|
||||
BOOST_CONSTEXPR absolute<Y> operator+(const Y& rval,const absolute<Y>& aval)
|
||||
{
|
||||
return absolute<Y>(aval.value()+rval);
|
||||
}
|
||||
|
||||
/// subtract a relative value from an absolute one
|
||||
template<class Y>
|
||||
absolute<Y> operator-(const absolute<Y>& aval,const Y& rval)
|
||||
BOOST_CONSTEXPR absolute<Y> operator-(const absolute<Y>& aval,const Y& rval)
|
||||
{
|
||||
return absolute<Y>(aval.value()-rval);
|
||||
}
|
||||
|
||||
/// subtracting two absolutes gives a difference
|
||||
template<class Y>
|
||||
Y operator-(const absolute<Y>& aval1,const absolute<Y>& aval2)
|
||||
BOOST_CONSTEXPR Y operator-(const absolute<Y>& aval1,const absolute<Y>& aval2)
|
||||
{
|
||||
return Y(aval1.value()-aval2.value());
|
||||
}
|
||||
|
||||
/// creates a quantity from an absolute unit and a raw value
|
||||
template<class D, class S, class T>
|
||||
quantity<absolute<unit<D, S> >, T> operator*(const T& t, const absolute<unit<D, S> >&)
|
||||
BOOST_CONSTEXPR quantity<absolute<unit<D, S> >, T> operator*(const T& t, const absolute<unit<D, S> >&)
|
||||
{
|
||||
return(quantity<absolute<unit<D, S> >, T>::from_value(t));
|
||||
}
|
||||
|
||||
/// creates a quantity from an absolute unit and a raw value
|
||||
template<class D, class S, class T>
|
||||
quantity<absolute<unit<D, S> >, T> operator*(const absolute<unit<D, S> >&, const T& t)
|
||||
BOOST_CONSTEXPR quantity<absolute<unit<D, S> >, T> operator*(const absolute<unit<D, S> >&, const T& t)
|
||||
{
|
||||
return(quantity<absolute<unit<D, S> >, T>::from_value(t));
|
||||
}
|
||||
@@ -138,9 +138,9 @@ namespace units {
|
||||
reduce_unit<From::unit_type>::type, \
|
||||
reduce_unit<To::unit_type>::type> \
|
||||
{ \
|
||||
static const bool is_defined = true; \
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = true; \
|
||||
typedef type_ type; \
|
||||
static type value() { return(value_); } \
|
||||
static BOOST_CONSTEXPR type value() { return(value_); } \
|
||||
}; \
|
||||
} \
|
||||
} \
|
||||
|
||||
@@ -83,21 +83,21 @@ class base_dimension :
|
||||
/// check_base_dimension will trigger an error earlier
|
||||
/// for compilers with less strict name lookup.
|
||||
/// INTERNAL ONLY
|
||||
friend Derived*
|
||||
friend BOOST_CONSTEXPR Derived*
|
||||
check_double_register(const units::base_dimension_ordinal<N>&)
|
||||
{ return(0); }
|
||||
|
||||
/// Register this ordinal
|
||||
/// INTERNAL ONLY
|
||||
friend detail::yes
|
||||
friend BOOST_CONSTEXPR detail::yes
|
||||
boost_units_is_registered(const units::base_dimension_ordinal<N>&)
|
||||
{ detail::yes result; return(result); }
|
||||
{ return(detail::yes()); }
|
||||
|
||||
/// But make sure we can identify the current instantiation!
|
||||
/// INTERNAL ONLY
|
||||
friend detail::yes
|
||||
friend BOOST_CONSTEXPR detail::yes
|
||||
boost_units_is_registered(const units::base_dimension_pair<Derived, N>&)
|
||||
{ detail::yes result; return(result); }
|
||||
{ return(detail::yes()); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -104,21 +104,21 @@ class base_unit :
|
||||
/// check_base_unit will trigger an error earlier
|
||||
/// for compilers with less strict name lookup.
|
||||
/// INTERNAL ONLY
|
||||
friend Derived*
|
||||
friend BOOST_CONSTEXPR Derived*
|
||||
check_double_register(const units::base_unit_ordinal<N>&)
|
||||
{ return(0); }
|
||||
|
||||
/// Register this ordinal
|
||||
/// INTERNAL ONLY
|
||||
friend detail::yes
|
||||
friend BOOST_CONSTEXPR detail::yes
|
||||
boost_units_unit_is_registered(const units::base_unit_ordinal<N>&)
|
||||
{ detail::yes result; return(result); }
|
||||
{ return(detail::yes()); }
|
||||
|
||||
/// But make sure we can identify the current instantiation!
|
||||
/// INTERNAL ONLY
|
||||
friend detail::yes
|
||||
friend BOOST_CONSTEXPR detail::yes
|
||||
boost_units_unit_is_registered(const units::base_unit_pair<Derived, N>&)
|
||||
{ detail::yes result; return(result); }
|
||||
{ return(detail::yes()); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<degree_base_unit, scale<60, static_rational<-1> > > ar
|
||||
|
||||
template<>
|
||||
struct base_unit_info<angle::arcminute_base_unit> {
|
||||
static const char* name() { return("arcminute"); }
|
||||
static const char* symbol() { return("'"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("arcminute"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("'"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ typedef scaled_base_unit<degree_base_unit, scale<3600, static_rational<-1> > >
|
||||
|
||||
template<>
|
||||
struct base_unit_info<angle::arcsecond_base_unit> {
|
||||
static const char* name() { return("arcsecond"); }
|
||||
static const char* symbol() { return("\""); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("arcsecond"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("\""); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<degree_base_unit, scale<360, static_rational<1> > > re
|
||||
|
||||
template<>
|
||||
struct base_unit_info<angle::revolution_base_unit> {
|
||||
static const char* name() { return("revolution"); }
|
||||
static const char* symbol() { return("rev"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("revolution"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("rev"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, sca
|
||||
|
||||
template<>
|
||||
struct base_unit_info<astronomical::light_day_base_unit> {
|
||||
static const char* name() { return("light day"); }
|
||||
static const char* symbol() { return("ldy"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("light day"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("ldy"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, sca
|
||||
|
||||
template<>
|
||||
struct base_unit_info<astronomical::light_hour_base_unit> {
|
||||
static const char* name() { return("light hour"); }
|
||||
static const char* symbol() { return("lhr"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("light hour"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("lhr"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, sca
|
||||
|
||||
template<>
|
||||
struct base_unit_info<astronomical::light_minute_base_unit> {
|
||||
static const char* name() { return("light minute"); }
|
||||
static const char* symbol() { return("lmn"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("light minute"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("lmn"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<boost::units::astronomical::light_second_base_unit, sca
|
||||
|
||||
template<>
|
||||
struct base_unit_info<astronomical::light_year_base_unit> {
|
||||
static const char* name() { return("light year"); }
|
||||
static const char* symbol() { return("ly"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("light year"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("ly"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<16, static_rational<-2> > > drac
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::drachm_base_unit> {
|
||||
static const char* name() { return("drachm"); }
|
||||
static const char* symbol() { return("drachm"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("drachm"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("drachm"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<20, static_rational<-1> > > fluid
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::fluid_ounce_base_unit> {
|
||||
static const char* name() { return("fluid ounce (imp.)"); }
|
||||
static const char* symbol() { return("fl oz"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("fluid ounce (imp.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("fl oz"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<3, static_rational<-1> > > foot_b
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::foot_base_unit> {
|
||||
static const char* name() { return("foot"); }
|
||||
static const char* symbol() { return("ft"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("foot"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("ft"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<220, static_rational<1> > > furlo
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::furlong_base_unit> {
|
||||
static const char* name() { return("furlong"); }
|
||||
static const char* symbol() { return("furlong"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("furlong"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("furlong"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef scaled_base_unit<pint_base_unit, scale<8, static_rational<1> > > gallon_
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::gallon_base_unit> {
|
||||
static const char* name() { return("gallon (imp.)"); }
|
||||
static const char* symbol() { return("gal"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("gallon (imp.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("gal"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef scaled_base_unit<pint_base_unit, scale<4, static_rational<-1> > > gill_b
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::gill_base_unit> {
|
||||
static const char* name() { return("gill (imp.)"); }
|
||||
static const char* symbol() { return("gill"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("gill (imp.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("gill"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<7000, static_rational<-1> > > gr
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::grain_base_unit> {
|
||||
static const char* name() { return("grain"); }
|
||||
static const char* symbol() { return("grain"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("grain"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("grain"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<112, static_rational<1> > > hund
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::hundredweight_base_unit> {
|
||||
static const char* name() { return("hundredweight"); }
|
||||
static const char* symbol() { return("cwt"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("hundredweight"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("cwt"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<36, static_rational<-1> > > inch_
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::inch_base_unit> {
|
||||
static const char* name() { return("inch"); }
|
||||
static const char* symbol() { return("in"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("inch"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("in"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<5280, static_rational<1> > > leag
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::league_base_unit> {
|
||||
static const char* name() { return("league"); }
|
||||
static const char* symbol() { return("league"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("league"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("league"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<1760, static_rational<1> > > mile
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::mile_base_unit> {
|
||||
static const char* name() { return("mile"); }
|
||||
static const char* symbol() { return("mi"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("mile"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("mi"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<2, static_rational<-4> > > ounce
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::ounce_base_unit> {
|
||||
static const char* name() { return("ounce"); }
|
||||
static const char* symbol() { return("oz"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("ounce"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("oz"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<1> > > quart_b
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::quart_base_unit> {
|
||||
static const char* name() { return("quart (imp.)"); }
|
||||
static const char* symbol() { return("qt"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("quart (imp.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("qt"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<28, static_rational<1> > > quart
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::quarter_base_unit> {
|
||||
static const char* name() { return("quarter"); }
|
||||
static const char* symbol() { return("quarter"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("quarter"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("quarter"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<14, static_rational<1> > > stone
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::stone_base_unit> {
|
||||
static const char* name() { return("stone"); }
|
||||
static const char* symbol() { return("st"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("stone"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("st"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<36000, static_rational<-1> > > th
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::thou_base_unit> {
|
||||
static const char* name() { return("thou"); }
|
||||
static const char* symbol() { return("thou"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("thou"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("thou"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<2240, static_rational<1> > > ton
|
||||
|
||||
template<>
|
||||
struct base_unit_info<imperial::ton_base_unit> {
|
||||
static const char* name() { return("long ton"); }
|
||||
static const char* symbol() { return("t"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("long ton"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("t"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<boost::units::information::bit_base_unit, scale<2, stat
|
||||
|
||||
template<>
|
||||
struct base_unit_info<information::byte_base_unit> {
|
||||
static const char* name() { return("byte"); }
|
||||
static const char* symbol() { return("B"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("byte"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("B"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<boost::units::information::bit_base_unit, scale<1, stat
|
||||
|
||||
template<>
|
||||
struct base_unit_info<information::shannon_base_unit> {
|
||||
static const char* name() { return("shannon"); }
|
||||
static const char* symbol() { return("Sh"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("shannon"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("Sh"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -27,8 +27,8 @@ typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rat
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::angstrom_base_unit> {
|
||||
static const char* name() { return("angstrom"); }
|
||||
static const char* symbol() { return("A"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("angstrom"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("A"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<boost::units::si::second_base_unit, scale<86400, static
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::day_base_unit> {
|
||||
static const char* name() { return("day"); }
|
||||
static const char* symbol() { return("d"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("day"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("d"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rat
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::fermi_base_unit> {
|
||||
static const char* name() { return("fermi"); }
|
||||
static const char* symbol() { return("fm"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("fermi"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("fm"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ typedef scaled_base_unit<boost::units::si::second_base_unit, scale<60, static_ra
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::hour_base_unit> {
|
||||
static const char* name() { return("hour"); }
|
||||
static const char* symbol() { return("h"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("hour"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("h"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<10, static_rat
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::micron_base_unit> {
|
||||
static const char* name() { return("micron"); }
|
||||
static const char* symbol() { return("u"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("micron"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("u"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ typedef scaled_base_unit<boost::units::si::second_base_unit, scale<60, static_ra
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::minute_base_unit> {
|
||||
static const char* name() { return("minute"); }
|
||||
static const char* symbol() { return("min"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("minute"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("min"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ typedef scaled_base_unit<boost::units::si::meter_base_unit, scale<1852, static_r
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::nautical_mile_base_unit> {
|
||||
static const char* name() { return("nautical mile"); }
|
||||
static const char* symbol() { return("nmi"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("nautical mile"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("nmi"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef scaled_base_unit<boost::units::si::kilogram_base_unit, scale<1000, stati
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::ton_base_unit> {
|
||||
static const char* name() { return("metric ton"); }
|
||||
static const char* symbol() { return("t"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("metric ton"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("t"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<boost::units::si::second_base_unit, scale<31557600, sta
|
||||
|
||||
template<>
|
||||
struct base_unit_info<metric::year_base_unit> {
|
||||
static const char* name() { return("Julian year"); }
|
||||
static const char* symbol() { return("yr"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("Julian year"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("yr"); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-1> > > cup_ba
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::cup_base_unit> {
|
||||
static const char* name() { return("cup"); }
|
||||
static const char* symbol() { return("c"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("cup"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("c"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<16, static_rational<-2> > > dram
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::dram_base_unit> {
|
||||
static const char* name() { return("dram (U.S.)"); }
|
||||
static const char* symbol() { return("dr"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("dram (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("dr"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-7> > > fluid_
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::fluid_dram_base_unit> {
|
||||
static const char* name() { return("fluid dram (U.S.)"); }
|
||||
static const char* symbol() { return("fl dr"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("fluid dram (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("fl dr"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<16, static_rational<-1> > > fluid
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::fluid_ounce_base_unit> {
|
||||
static const char* name() { return("fluid ounce (U.S.)"); }
|
||||
static const char* symbol() { return("fl oz"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("fluid ounce (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("fl oz"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<3, static_rational<-1> > > foot_b
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::foot_base_unit> {
|
||||
static const char* name() { return("foot"); }
|
||||
static const char* symbol() { return("ft"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("foot"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("ft"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<3> > > gallon_
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::gallon_base_unit> {
|
||||
static const char* name() { return("gallon (U.S.)"); }
|
||||
static const char* symbol() { return("gal"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("gallon (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("gal"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-2> > > gill_b
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::gill_base_unit> {
|
||||
static const char* name() { return("gill (U.S.)"); }
|
||||
static const char* symbol() { return("gi"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("gill (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("gi"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<7000, static_rational<-1> > > gr
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::grain_base_unit> {
|
||||
static const char* name() { return("grain"); }
|
||||
static const char* symbol() { return("gr"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("grain"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("gr"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -29,8 +29,8 @@ typedef scaled_base_unit<pound_base_unit, scale<100, static_rational<1> > > hund
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::hundredweight_base_unit> {
|
||||
static const char* name() { return("hundredweight (U.S.)"); }
|
||||
static const char* symbol() { return("cwt"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("hundredweight (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("cwt"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<36, static_rational<-1> > > inch_
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::inch_base_unit> {
|
||||
static const char* name() { return("inch"); }
|
||||
static const char* symbol() { return("in"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("inch"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("in"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<36000, static_rational<-1> > > mi
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::mil_base_unit> {
|
||||
static const char* name() { return("mil"); }
|
||||
static const char* symbol() { return("mil"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("mil"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("mil"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<yard_base_unit, scale<1760, static_rational<1> > > mile
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::mile_base_unit> {
|
||||
static const char* name() { return("mile"); }
|
||||
static const char* symbol() { return("mi"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("mile"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("mi"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<7680, static_rational<-1> > > min
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::minim_base_unit> {
|
||||
static const char* name() { return("minim (U.S.)"); }
|
||||
static const char* symbol() { return("minim"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("minim (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("minim"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<2, static_rational<-4> > > ounce
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::ounce_base_unit> {
|
||||
static const char* name() { return("ounce"); }
|
||||
static const char* symbol() { return("oz"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("ounce"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("oz"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<1> > > quart_b
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::quart_base_unit> {
|
||||
static const char* name() { return("quart (U.S.)"); }
|
||||
static const char* symbol() { return("qt"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("quart (U.S.)"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("qt"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<2, static_rational<-5> > > tables
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::tablespoon_base_unit> {
|
||||
static const char* name() { return("tablespoon"); }
|
||||
static const char* symbol() { return("tbsp"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("tablespoon"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("tbsp"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pint_base_unit, scale<96, static_rational<-1> > > teasp
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::teaspoon_base_unit> {
|
||||
static const char* name() { return("teaspoon"); }
|
||||
static const char* symbol() { return("tsp"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("teaspoon"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("tsp"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -28,8 +28,8 @@ typedef scaled_base_unit<pound_base_unit, scale<2000, static_rational<1> > > ton
|
||||
|
||||
template<>
|
||||
struct base_unit_info<us::ton_base_unit> {
|
||||
static const char* name() { return("short ton"); }
|
||||
static const char* symbol() { return("t"); }
|
||||
static BOOST_CONSTEXPR const char* name() { return("short ton"); }
|
||||
static BOOST_CONSTEXPR const char* symbol() { return("t"); }
|
||||
};
|
||||
|
||||
} // namespace units
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace units {
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -56,6 +57,7 @@ isfinite BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isinf BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -65,6 +67,7 @@ isinf BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isnan BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -74,6 +77,7 @@ isnan BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -83,6 +87,7 @@ isnormal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -93,6 +98,7 @@ isgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -103,6 +109,7 @@ isgreaterequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isless BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -113,6 +120,7 @@ isless BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -123,6 +131,7 @@ islessequal BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -133,6 +142,7 @@ islessgreater BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -143,6 +153,7 @@ isunordered BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
abs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -155,6 +166,7 @@ abs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
ceil BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -167,6 +179,7 @@ ceil BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
copysign BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -180,6 +193,7 @@ copysign BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
fabs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -192,6 +206,7 @@ fabs BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
floor BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -204,6 +219,7 @@ floor BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
fdim BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -219,6 +235,7 @@ fdim BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit1,class Unit2,class Unit3,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename add_typeof_helper<
|
||||
typename multiply_typeof_helper<quantity<Unit1,Y>,
|
||||
quantity<Unit2,Y> >::type,
|
||||
@@ -243,6 +260,7 @@ fma BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit1,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
fmax BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -256,6 +274,7 @@ fmax BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
fmin BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
@@ -269,6 +288,7 @@ fmin BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
int
|
||||
fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -279,6 +299,7 @@ fpclassify BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename root_typeof_helper<
|
||||
typename add_typeof_helper<
|
||||
typename power_typeof_helper<quantity<Unit,Y>,
|
||||
@@ -302,6 +323,7 @@ hypot BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,const quantit
|
||||
// does ISO C++ support long long? g++ claims not
|
||||
//template<class Unit,class Y>
|
||||
//inline
|
||||
//BOOST_CONSTEXPR
|
||||
//quantity<Unit,long long>
|
||||
//llrint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
//{
|
||||
@@ -315,6 +337,7 @@ hypot BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,const quantit
|
||||
// does ISO C++ support long long? g++ claims not
|
||||
//template<class Unit,class Y>
|
||||
//inline
|
||||
//BOOST_CONSTEXPR
|
||||
//quantity<Unit,long long>
|
||||
//llround BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
//{
|
||||
@@ -329,6 +352,7 @@ hypot BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,const quantit
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -343,6 +367,7 @@ nearbyint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y> nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
{
|
||||
@@ -354,6 +379,7 @@ quantity<Unit,Y> nextafter BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit
|
||||
}
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y> nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q1,
|
||||
const quantity<Unit,Y>& q2)
|
||||
{
|
||||
@@ -371,6 +397,7 @@ quantity<Unit,Y> nexttoward BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Uni
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
rint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -385,6 +412,7 @@ rint BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
round BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -397,6 +425,7 @@ round BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
int
|
||||
signbit BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -407,6 +436,7 @@ signbit BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit,Y>
|
||||
trunc BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
{
|
||||
@@ -419,6 +449,7 @@ trunc BOOST_PREVENT_MACRO_SUBSTITUTION (const quantity<Unit,Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit, Y>
|
||||
fmod(const quantity<Unit,Y>& q1, const quantity<Unit,Y>& q2)
|
||||
{
|
||||
@@ -431,6 +462,7 @@ fmod(const quantity<Unit,Y>& q1, const quantity<Unit,Y>& q2)
|
||||
|
||||
template<class Unit, class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit, Y>
|
||||
modf(const quantity<Unit, Y>& q1, quantity<Unit, Y>* q2)
|
||||
{
|
||||
@@ -443,6 +475,7 @@ modf(const quantity<Unit, Y>& q1, quantity<Unit, Y>* q2)
|
||||
|
||||
template<class Unit, class Y, class Int>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit, Y>
|
||||
frexp(const quantity<Unit, Y>& q,Int* ex)
|
||||
{
|
||||
@@ -457,6 +490,7 @@ frexp(const quantity<Unit, Y>& q,Int* ex)
|
||||
/// and roots can be computed by @c pow<Ex> and @c root<Rt> respectively.
|
||||
template<class S, class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
|
||||
pow(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q1,
|
||||
const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q2)
|
||||
@@ -470,6 +504,7 @@ pow(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q1,
|
||||
|
||||
template<class S, class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
|
||||
exp(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
|
||||
{
|
||||
@@ -482,6 +517,7 @@ exp(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
|
||||
|
||||
template<class Unit, class Y, class Int>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<Unit, Y>
|
||||
ldexp(const quantity<Unit, Y>& q,const Int& ex)
|
||||
{
|
||||
@@ -494,6 +530,7 @@ ldexp(const quantity<Unit, Y>& q,const Int& ex)
|
||||
|
||||
template<class S, class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
|
||||
log(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
|
||||
{
|
||||
@@ -506,6 +543,7 @@ log(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
|
||||
|
||||
template<class S, class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>
|
||||
log10(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
|
||||
{
|
||||
@@ -518,6 +556,7 @@ log10(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y>& q)
|
||||
|
||||
template<class Unit,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename root_typeof_helper<
|
||||
quantity<Unit,Y>,
|
||||
static_rational<2>
|
||||
@@ -546,6 +585,7 @@ namespace units {
|
||||
|
||||
/// cos of theta in radians
|
||||
template<class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename dimensionless_quantity<si::system,Y>::type
|
||||
cos(const quantity<si::plane_angle,Y>& theta)
|
||||
{
|
||||
@@ -555,6 +595,7 @@ cos(const quantity<si::plane_angle,Y>& theta)
|
||||
|
||||
/// sin of theta in radians
|
||||
template<class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename dimensionless_quantity<si::system,Y>::type
|
||||
sin(const quantity<si::plane_angle,Y>& theta)
|
||||
{
|
||||
@@ -564,6 +605,7 @@ sin(const quantity<si::plane_angle,Y>& theta)
|
||||
|
||||
/// tan of theta in radians
|
||||
template<class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename dimensionless_quantity<si::system,Y>::type
|
||||
tan(const quantity<si::plane_angle,Y>& theta)
|
||||
{
|
||||
@@ -573,6 +615,7 @@ tan(const quantity<si::plane_angle,Y>& theta)
|
||||
|
||||
/// cos of theta in other angular units
|
||||
template<class System,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename dimensionless_quantity<System,Y>::type
|
||||
cos(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
|
||||
{
|
||||
@@ -581,6 +624,7 @@ cos(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
|
||||
|
||||
/// sin of theta in other angular units
|
||||
template<class System,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename dimensionless_quantity<System,Y>::type
|
||||
sin(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
|
||||
{
|
||||
@@ -589,6 +633,7 @@ sin(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
|
||||
|
||||
/// tan of theta in other angular units
|
||||
template<class System,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename dimensionless_quantity<System,Y>::type
|
||||
tan(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
|
||||
{
|
||||
@@ -597,6 +642,7 @@ tan(const quantity<unit<plane_angle_dimension,System>,Y>& theta)
|
||||
|
||||
/// acos of dimensionless quantity returning angle in same system
|
||||
template<class Y,class System>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
|
||||
acos(const quantity<unit<dimensionless_type, homogeneous_system<System> >,Y>& val)
|
||||
{
|
||||
@@ -606,6 +652,7 @@ acos(const quantity<unit<dimensionless_type, homogeneous_system<System> >,Y>& va
|
||||
|
||||
/// acos of dimensionless quantity returning angle in radians
|
||||
template<class Y>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<angle::radian_base_unit::unit_type,Y>
|
||||
acos(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>,Y>& val)
|
||||
{
|
||||
@@ -615,6 +662,7 @@ acos(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>
|
||||
|
||||
/// asin of dimensionless quantity returning angle in same system
|
||||
template<class Y,class System>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
|
||||
asin(const quantity<unit<dimensionless_type, homogeneous_system<System> >,Y>& val)
|
||||
{
|
||||
@@ -624,6 +672,7 @@ asin(const quantity<unit<dimensionless_type, homogeneous_system<System> >,Y>& va
|
||||
|
||||
/// asin of dimensionless quantity returning angle in radians
|
||||
template<class Y>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<angle::radian_base_unit::unit_type,Y>
|
||||
asin(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>,Y>& val)
|
||||
{
|
||||
@@ -633,6 +682,7 @@ asin(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>
|
||||
|
||||
/// atan of dimensionless quantity returning angle in same system
|
||||
template<class Y,class System>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<unit<plane_angle_dimension, homogeneous_system<System> >,Y>
|
||||
atan(const quantity<unit<dimensionless_type, homogeneous_system<System> >, Y>& val)
|
||||
{
|
||||
@@ -642,6 +692,7 @@ atan(const quantity<unit<dimensionless_type, homogeneous_system<System> >, Y>& v
|
||||
|
||||
/// atan of dimensionless quantity returning angle in radians
|
||||
template<class Y>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<angle::radian_base_unit::unit_type,Y>
|
||||
atan(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>, Y>& val)
|
||||
{
|
||||
@@ -651,6 +702,7 @@ atan(const quantity<unit<dimensionless_type, heterogeneous_dimensionless_system>
|
||||
|
||||
/// atan2 of @c value_type returning angle in radians
|
||||
template<class Y, class Dimension, class System>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<unit<plane_angle_dimension, homogeneous_system<System> >, Y>
|
||||
atan2(const quantity<unit<Dimension, homogeneous_system<System> >, Y>& y,
|
||||
const quantity<unit<Dimension, homogeneous_system<System> >, Y>& x)
|
||||
@@ -661,6 +713,7 @@ atan2(const quantity<unit<Dimension, homogeneous_system<System> >, Y>& y,
|
||||
|
||||
/// atan2 of @c value_type returning angle in radians
|
||||
template<class Y, class Dimension, class System>
|
||||
BOOST_CONSTEXPR
|
||||
quantity<angle::radian_base_unit::unit_type,Y>
|
||||
atan2(const quantity<unit<Dimension, heterogeneous_system<System> >, Y>& y,
|
||||
const quantity<unit<Dimension, heterogeneous_system<System> >, Y>& x)
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
#define BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(a, b) BOOST_STATIC_ASSERT((sizeof(a) == sizeof(b)))
|
||||
#else
|
||||
///INTERNAL ONLY
|
||||
#define BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(a, b) ((void)0)
|
||||
#define BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(a, b)
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_UNITS_DOXYGEN
|
||||
|
||||
@@ -51,7 +51,7 @@ struct conversion_helper;
|
||||
template<class From, class To>
|
||||
struct conversion_helper
|
||||
{
|
||||
static To convert(const From&);
|
||||
static BOOST_CONSTEXPR To convert(const From&);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -77,9 +77,9 @@ struct conversion_helper
|
||||
template<> \
|
||||
struct base_unit_converter<Source, reduce_unit<Destination::unit_type>::type> \
|
||||
{ \
|
||||
static const bool is_defined = true; \
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = true; \
|
||||
typedef type_ type; \
|
||||
static type value() { return(value_); } \
|
||||
static BOOST_CONSTEXPR type value() { return(value_); } \
|
||||
}; \
|
||||
} \
|
||||
} \
|
||||
@@ -103,9 +103,9 @@ struct conversion_helper
|
||||
BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Destination, typename Source::dimension_type)\
|
||||
> \
|
||||
{ \
|
||||
static const bool is_defined = true; \
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = true; \
|
||||
typedef type_ type; \
|
||||
static type value() { return(value_); } \
|
||||
static BOOST_CONSTEXPR type value() { return(value_); } \
|
||||
}; \
|
||||
} \
|
||||
} \
|
||||
@@ -121,7 +121,7 @@ struct conversion_helper
|
||||
template<> \
|
||||
struct unscaled_get_default_conversion<unscale<Source>::type> \
|
||||
{ \
|
||||
static const bool is_defined = true; \
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = true; \
|
||||
typedef Dest::unit_type type; \
|
||||
}; \
|
||||
} \
|
||||
@@ -140,7 +140,7 @@ struct conversion_helper
|
||||
template<BOOST_PP_SEQ_ENUM(Params)> \
|
||||
struct unscaled_get_default_conversion<Source> \
|
||||
{ \
|
||||
static const bool is_defined = true; \
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = true; \
|
||||
typedef typename Dest::unit_type type; \
|
||||
}; \
|
||||
} \
|
||||
@@ -158,8 +158,8 @@ namespace units { \
|
||||
namespace namespace_ { \
|
||||
struct name_ ## _base_unit \
|
||||
: base_unit<name_ ## _base_unit, unit::dimension_type, id> { \
|
||||
static const char* name() { return(name_string_); } \
|
||||
static const char* symbol() { return(symbol_string_); } \
|
||||
static BOOST_CONSTEXPR const char* name() { return(name_string_); } \
|
||||
static BOOST_CONSTEXPR const char* symbol() { return(symbol_string_); } \
|
||||
}; \
|
||||
} \
|
||||
} \
|
||||
@@ -170,6 +170,7 @@ BOOST_UNITS_DEFAULT_CONVERSION(namespace_::name_ ## _base_unit, unit)
|
||||
/// Find the conversion factor between two units.
|
||||
template<class FromUnit,class ToUnit>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename one_to_double_type<
|
||||
typename detail::conversion_factor_helper<FromUnit, ToUnit>::type
|
||||
>::type
|
||||
|
||||
@@ -32,7 +32,7 @@ struct reduce_unit<absolute<unit<D, S> > >
|
||||
namespace detail {
|
||||
|
||||
struct undefined_affine_conversion_base {
|
||||
static const bool is_defined = false;
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = false;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@@ -51,7 +51,7 @@ struct affine_conversion_impl<true, ReverseIsDefined>
|
||||
{
|
||||
template<class Unit1, class Unit2, class T0, class T1>
|
||||
struct apply {
|
||||
static T1 value(const T0& t0)
|
||||
static BOOST_CONSTEXPR T1 value(const T0& t0)
|
||||
{
|
||||
return(
|
||||
t0 *
|
||||
@@ -67,7 +67,7 @@ struct affine_conversion_impl<false, true>
|
||||
template<class Unit1, class Unit2, class T0, class T1>
|
||||
struct apply
|
||||
{
|
||||
static T1 value(const T0& t0)
|
||||
static BOOST_CONSTEXPR T1 value(const T0& t0)
|
||||
{
|
||||
return(
|
||||
(t0 - affine_conversion_helper<typename reduce_unit<Unit2>::type, typename reduce_unit<Unit1>::type>::value()) *
|
||||
@@ -84,7 +84,7 @@ struct conversion_helper<quantity<absolute<Unit1>, T1>, quantity<absolute<Unit2>
|
||||
{
|
||||
typedef quantity<absolute<Unit1>, T1> from_quantity_type;
|
||||
typedef quantity<absolute<Unit2>, T2> to_quantity_type;
|
||||
static to_quantity_type convert(const from_quantity_type& source)
|
||||
static BOOST_CONSTEXPR to_quantity_type convert(const from_quantity_type& source)
|
||||
{
|
||||
return(
|
||||
to_quantity_type::from_value(
|
||||
|
||||
@@ -46,12 +46,12 @@ struct call_base_unit_converter;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
struct undefined_base_unit_converter_base {
|
||||
static const bool is_defined = false;
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = false;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
struct no_default_conversion {
|
||||
static const bool is_defined = false;
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = false;
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
@@ -110,11 +110,10 @@ struct base_unit_converter_base : undefined_base_unit_converter_base {
|
||||
template<class Source>
|
||||
struct base_unit_converter_base<Source, BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(Source, typename Source::dimension_type)>
|
||||
{
|
||||
static const bool is_defined = true;
|
||||
BOOST_STATIC_CONSTEXPR bool is_defined = true;
|
||||
typedef one type;
|
||||
static type value() {
|
||||
one result;
|
||||
return(result);
|
||||
static BOOST_CONSTEXPR type value() {
|
||||
return(one());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -135,7 +134,7 @@ struct do_call_base_unit_converter {
|
||||
typedef typename mpl::divides<source_factor, destination_factor>::type factor;
|
||||
typedef eval_scale_list<factor> eval_factor;
|
||||
typedef typename multiply_typeof_helper<typename converter::type, typename eval_factor::type>::type type;
|
||||
static type value()
|
||||
static BOOST_CONSTEXPR type value()
|
||||
{
|
||||
return(converter::value() * eval_factor::value());
|
||||
}
|
||||
@@ -172,9 +171,8 @@ struct call_base_unit_converter_base_unit_impl<false, true>
|
||||
{
|
||||
typedef do_call_base_unit_converter<Dest, typename Source::unit_type> converter;
|
||||
typedef typename divide_typeof_helper<one, typename converter::type>::type type;
|
||||
static type value() {
|
||||
one numerator;
|
||||
return(numerator / converter::value());
|
||||
static BOOST_CONSTEXPR type value() {
|
||||
return(one() / converter::value());
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -200,7 +198,7 @@ struct call_base_unit_converter_base_unit_impl<false, false>
|
||||
>::type,
|
||||
typename end::type
|
||||
>::type type;
|
||||
static type value() {
|
||||
static BOOST_CONSTEXPR type value() {
|
||||
return(start::value() * conversion::value() / end::value());
|
||||
}
|
||||
};
|
||||
@@ -220,7 +218,7 @@ struct get_default_conversion_impl
|
||||
typedef typename multiply_typeof_helper<typename power_typeof_helper<new_source, exponent>::type, typename next_iteration::unit_type>::type unit_type;
|
||||
typedef call_base_unit_converter<source, new_source> conversion;
|
||||
typedef typename multiply_typeof_helper<typename conversion::type, typename next_iteration::type>::type type;
|
||||
static type value() {
|
||||
static BOOST_CONSTEXPR type value() {
|
||||
return(static_rational_power<exponent>(conversion::value()) * next_iteration::value());
|
||||
}
|
||||
};
|
||||
@@ -234,9 +232,8 @@ struct get_default_conversion_impl<0>
|
||||
{
|
||||
typedef unit<dimensionless_type, heterogeneous_system<heterogeneous_system_impl<dimensionless_type, dimensionless_type, no_scale> > > unit_type;
|
||||
typedef one type;
|
||||
static one value() {
|
||||
one result;
|
||||
return(result);
|
||||
static BOOST_CONSTEXPR one value() {
|
||||
return(one());
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -272,7 +269,7 @@ struct call_base_unit_converter_impl<false>
|
||||
>::type,
|
||||
typename impl::type
|
||||
>::type type;
|
||||
static type value() {
|
||||
static BOOST_CONSTEXPR type value() {
|
||||
return(start::value() * conversion::value() / impl::value());
|
||||
}
|
||||
};
|
||||
@@ -314,7 +311,7 @@ struct conversion_impl
|
||||
typedef typename reduce_unit<units::unit<dimensions, DestinationSystem> >::type reduced_unit;
|
||||
typedef detail::call_base_unit_converter<unit, reduced_unit> converter;
|
||||
typedef typename multiply_typeof_helper<typename converter::type, typename next_iteration::type>::type type;
|
||||
static type value() { return(static_rational_power<typename unit_pair::value_type>(converter::value()) * next_iteration::value()); }
|
||||
static BOOST_CONSTEXPR type value() { return(static_rational_power<typename unit_pair::value_type>(converter::value()) * next_iteration::value()); }
|
||||
};
|
||||
};
|
||||
|
||||
@@ -325,7 +322,7 @@ struct conversion_impl<0>
|
||||
struct apply
|
||||
{
|
||||
typedef one type;
|
||||
static type value() { one result; return(result); }
|
||||
static BOOST_CONSTEXPR type value() { return(one()); }
|
||||
};
|
||||
};
|
||||
|
||||
@@ -338,11 +335,9 @@ struct conversion_helper<quantity<Unit1, T1>, quantity<Unit2, T2> >
|
||||
{
|
||||
/// INTERNAL ONLY
|
||||
typedef quantity<Unit2, T2> destination_type;
|
||||
static destination_type convert(const quantity<Unit1, T1>& source)
|
||||
static BOOST_CONSTEXPR destination_type convert(const quantity<Unit1, T1>& source)
|
||||
{
|
||||
Unit1 u1;
|
||||
Unit2 u2;
|
||||
return(destination_type::from_value(static_cast<T2>(source.value() * conversion_factor(u1, u2))));
|
||||
return(destination_type::from_value(static_cast<T2>(source.value() * conversion_factor(Unit1(), Unit2()))));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -365,7 +360,7 @@ struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, homoge
|
||||
// homogeneous_system<L2>
|
||||
//> impl;
|
||||
//typedef typename impl::type type;
|
||||
//static type value()
|
||||
//static BOOST_CONSTEXPR type value()
|
||||
//{
|
||||
// return(impl::value());
|
||||
//}
|
||||
@@ -384,7 +379,7 @@ struct conversion_factor_helper<unit<D, heterogeneous_system<L1> >, unit<D, homo
|
||||
//> impl;
|
||||
//typedef eval_scale_list<typename L1::scale> scale;
|
||||
//typedef typename multiply_typeof_helper<typename impl::type, typename scale::type>::type type;
|
||||
//static type value()
|
||||
//static BOOST_CONSTEXPR type value()
|
||||
//{
|
||||
// return(impl::value() * scale::value());
|
||||
//}
|
||||
@@ -406,10 +401,9 @@ struct conversion_factor_helper<unit<D, homogeneous_system<L1> >, unit<D, hetero
|
||||
//> impl;
|
||||
//typedef eval_scale_list<typename L2::scale> scale;
|
||||
//typedef typename multiply_typeof_helper<typename impl::type, typename scale::type>::type type;
|
||||
//static type value()
|
||||
//static BOOST_CONSTEXPR type value()
|
||||
//{
|
||||
// one numerator;
|
||||
// return(numerator / (impl::value() * scale::value()));
|
||||
// return(one() / (impl::value() * scale::value()));
|
||||
//}
|
||||
};
|
||||
|
||||
@@ -443,7 +437,7 @@ struct conversion_factor_helper<unit<D, heterogeneous_system<S1> >, unit<D, hete
|
||||
typename conversion1::type,
|
||||
typename divide_typeof_helper<typename scale::type, typename conversion2::type>::type
|
||||
>::type type;
|
||||
static type value()
|
||||
static BOOST_CONSTEXPR type value()
|
||||
{
|
||||
return(conversion1::value() * (scale::value() / conversion2::value()));
|
||||
}
|
||||
|
||||
@@ -598,8 +598,8 @@ struct set_insert<false> {
|
||||
|
||||
template<class Set, class T>
|
||||
struct has_key {
|
||||
static const long size = sizeof(Set::lookup((wrap<T>*)0));
|
||||
static const bool value = (size == sizeof(set_yes));
|
||||
BOOST_STATIC_CONSTEXPR long size = sizeof(Set::lookup((wrap<T>*)0));
|
||||
BOOST_STATIC_CONSTEXPR bool value = (size == sizeof(set_yes));
|
||||
};
|
||||
|
||||
template<int N>
|
||||
@@ -826,7 +826,7 @@ struct normalize_units {
|
||||
dimensions
|
||||
>::type matrix;
|
||||
typedef typename make_square_and_invert<matrix>::type type;
|
||||
static const long extra = (type::size::value) - (T::size::value);
|
||||
BOOST_STATIC_CONSTEXPR long extra = (type::size::value) - (T::size::value);
|
||||
};
|
||||
|
||||
// multiply_add_units computes M x V
|
||||
@@ -977,7 +977,7 @@ struct is_simple_system_impl {
|
||||
typename test::base_dimension_type
|
||||
>
|
||||
> type;
|
||||
static const bool value = (type::value);
|
||||
BOOST_STATIC_CONSTEXPR bool value = (type::value);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1001,7 +1001,7 @@ struct is_simple_system {
|
||||
typename test::base_dimension_type
|
||||
>
|
||||
>::type type;
|
||||
static const bool value = type::value;
|
||||
BOOST_STATIC_CONSTEXPR bool value = type::value;
|
||||
};
|
||||
|
||||
template<bool>
|
||||
|
||||
@@ -17,12 +17,11 @@ namespace boost {
|
||||
|
||||
namespace units {
|
||||
|
||||
struct one { one() {} };
|
||||
struct one { BOOST_CONSTEXPR one() {} };
|
||||
|
||||
// workaround for pathscale.
|
||||
inline one make_one() {
|
||||
one result;
|
||||
return(result);
|
||||
inline BOOST_CONSTEXPR one make_one() {
|
||||
return(one());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -44,21 +43,20 @@ struct multiply_typeof_helper<one, one>
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline T operator*(const one&, const T& t)
|
||||
inline BOOST_CONSTEXPR T operator*(const one&, const T& t)
|
||||
{
|
||||
return(t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T operator*(const T& t, const one&)
|
||||
inline BOOST_CONSTEXPR T operator*(const T& t, const one&)
|
||||
{
|
||||
return(t);
|
||||
}
|
||||
|
||||
inline one operator*(const one&, const one&)
|
||||
inline BOOST_CONSTEXPR one operator*(const one&, const one&)
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
return(one());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@@ -80,32 +78,31 @@ struct divide_typeof_helper<one, one>
|
||||
};
|
||||
|
||||
template<class T>
|
||||
inline T operator/(const T& t, const one&)
|
||||
inline BOOST_CONSTEXPR T operator/(const T& t, const one&)
|
||||
{
|
||||
return(t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T operator/(const one&, const T& t)
|
||||
inline BOOST_CONSTEXPR T operator/(const one&, const T& t)
|
||||
{
|
||||
return(1/t);
|
||||
}
|
||||
|
||||
inline one operator/(const one&, const one&)
|
||||
inline BOOST_CONSTEXPR one operator/(const one&, const one&)
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
return(one());
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline bool operator>(const boost::units::one&, const T& t) {
|
||||
inline BOOST_CONSTEXPR bool operator>(const boost::units::one&, const T& t) {
|
||||
return(1 > t);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
T one_to_double(const T& t) { return t; }
|
||||
BOOST_CONSTEXPR T one_to_double(const T& t) { return t; }
|
||||
|
||||
inline double one_to_double(const one&) { return 1.0; }
|
||||
inline BOOST_CONSTEXPR double one_to_double(const one&) { return 1.0; }
|
||||
|
||||
template<class T>
|
||||
struct one_to_double_type { typedef T type; };
|
||||
|
||||
@@ -26,11 +26,11 @@ struct ordinal_tag {};
|
||||
template<int N>
|
||||
struct ordinal {
|
||||
typedef detail::ordinal_tag tag;
|
||||
static const long value = N;
|
||||
BOOST_STATIC_CONSTEXPR long value = N;
|
||||
};
|
||||
|
||||
template<int N>
|
||||
const long ordinal<N>::value;
|
||||
BOOST_CONSTEXPR_OR_CONST long ordinal<N>::value;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace units {
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct no { no() {} char dummy; };
|
||||
struct no { BOOST_CONSTEXPR no() : dummy() {} char dummy; };
|
||||
struct yes { no dummy[2]; };
|
||||
|
||||
template<bool> struct ordinal_has_already_been_defined;
|
||||
@@ -37,15 +37,17 @@ struct ordinal_has_already_been_defined<false> { typedef void type; };
|
||||
/// be found by ADL
|
||||
/// INTERNAL ONLY
|
||||
template<class T>
|
||||
BOOST_CONSTEXPR
|
||||
detail::no
|
||||
boost_units_is_registered(const T&)
|
||||
{ detail::no result; return(result); }
|
||||
{ return(detail::no()); }
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<class T>
|
||||
BOOST_CONSTEXPR
|
||||
detail::no
|
||||
boost_units_unit_is_registered(const T&)
|
||||
{ detail::no result; return(result); }
|
||||
{ return(detail::no()); }
|
||||
|
||||
} // namespace units
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ template<class R, class Y>
|
||||
struct static_rational_power_impl
|
||||
{
|
||||
typedef typename typeof_pow_adl_barrier::typeof_pow<Y>::type type;
|
||||
static type call(const Y& y)
|
||||
static BOOST_CONSTEXPR type call(const Y& y)
|
||||
{
|
||||
using std::pow;
|
||||
return(pow(y, static_cast<double>(R::Numerator) / static_cast<double>(R::Denominator)));
|
||||
@@ -61,10 +61,9 @@ template<class R>
|
||||
struct static_rational_power_impl<R, one>
|
||||
{
|
||||
typedef one type;
|
||||
static one call(const one&)
|
||||
static BOOST_CONSTEXPR one call(const one&)
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
return(one());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -72,10 +71,9 @@ template<long N>
|
||||
struct static_rational_power_impl<static_rational<N, 1>, one>
|
||||
{
|
||||
typedef one type;
|
||||
static one call(const one&)
|
||||
static BOOST_CONSTEXPR one call(const one&)
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
return(one());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -91,10 +89,9 @@ struct static_int_power_impl<N, true>
|
||||
typedef typename multiply_typeof_helper<Y, Y>::type square_type;
|
||||
typedef typename static_int_power_impl<(N >> 1)>::template apply<square_type, R> next;
|
||||
typedef typename next::type type;
|
||||
static type call(const Y& y, const R& r)
|
||||
static BOOST_CONSTEXPR type call(const Y& y, const R& r)
|
||||
{
|
||||
const square_type square = y * y;
|
||||
return(next::call(square, r));
|
||||
return(next::call(static_cast<square_type>(y * y), r));
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -109,10 +106,9 @@ struct static_int_power_impl<N, false>
|
||||
typedef typename multiply_typeof_helper<Y, R>::type new_r;
|
||||
typedef typename static_int_power_impl<(N >> 1)>::template apply<square_type, new_r> next;
|
||||
typedef typename next::type type;
|
||||
static type call(const Y& y, const R& r)
|
||||
static BOOST_CONSTEXPR type call(const Y& y, const R& r)
|
||||
{
|
||||
const Y square = y * y;
|
||||
return(next::call(square, y * r));
|
||||
return(next::call(static_cast<Y>(y * y), y * r));
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -124,7 +120,7 @@ struct static_int_power_impl<1, false>
|
||||
struct apply
|
||||
{
|
||||
typedef typename multiply_typeof_helper<Y, R>::type type;
|
||||
static type call(const Y& y, const R& r)
|
||||
static BOOST_CONSTEXPR type call(const Y& y, const R& r)
|
||||
{
|
||||
return(y * r);
|
||||
}
|
||||
@@ -138,7 +134,7 @@ struct static_int_power_impl<0, true>
|
||||
struct apply
|
||||
{
|
||||
typedef R type;
|
||||
static R call(const Y&, const R& r)
|
||||
static BOOST_CONSTEXPR R call(const Y&, const R& r)
|
||||
{
|
||||
return(r);
|
||||
}
|
||||
@@ -156,10 +152,9 @@ struct static_int_power_sign_impl<N, false>
|
||||
{
|
||||
typedef typename static_int_power_impl<N>::template apply<Y, one> impl;
|
||||
typedef typename impl::type type;
|
||||
static type call(const Y& y)
|
||||
static BOOST_CONSTEXPR type call(const Y& y)
|
||||
{
|
||||
one result;
|
||||
return(impl::call(y, result));
|
||||
return(impl::call(y, one()));
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -172,10 +167,9 @@ struct static_int_power_sign_impl<N, true>
|
||||
{
|
||||
typedef typename static_int_power_impl<-N>::template apply<Y, one> impl;
|
||||
typedef typename divide_typeof_helper<one, typename impl::type>::type type;
|
||||
static type call(const Y& y)
|
||||
static BOOST_CONSTEXPR type call(const Y& y)
|
||||
{
|
||||
one result;
|
||||
return(result/impl::call(y, result));
|
||||
return(one()/impl::call(y, one()));
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -185,13 +179,14 @@ struct static_rational_power_impl<static_rational<N, 1>, Y>
|
||||
{
|
||||
typedef typename static_int_power_sign_impl<N>::template apply<Y> impl;
|
||||
typedef typename impl::type type;
|
||||
static type call(const Y& y)
|
||||
static BOOST_CONSTEXPR type call(const Y& y)
|
||||
{
|
||||
return(impl::call(y));
|
||||
}
|
||||
};
|
||||
|
||||
template<class R, class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename detail::static_rational_power_impl<R, Y>::type static_rational_power(const Y& y)
|
||||
{
|
||||
return(detail::static_rational_power_impl<R, Y>::call(y));
|
||||
|
||||
@@ -143,7 +143,7 @@ struct eval_scale_list_impl
|
||||
{
|
||||
typedef typename eval_scale_list_impl<N-1>::template apply<typename Begin::next> next_iteration;
|
||||
typedef typename multiply_typeof_helper<typename next_iteration::type, typename Begin::item::value_type>::type type;
|
||||
static type value()
|
||||
static BOOST_CONSTEXPR type value()
|
||||
{
|
||||
return(next_iteration::value() * Begin::item::value());
|
||||
}
|
||||
@@ -157,10 +157,9 @@ struct eval_scale_list_impl<0>
|
||||
struct apply
|
||||
{
|
||||
typedef one type;
|
||||
static one value()
|
||||
static BOOST_CONSTEXPR one value()
|
||||
{
|
||||
one result;
|
||||
return(result);
|
||||
return(one());
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -225,6 +224,22 @@ struct times_impl<boost::units::scale_dim_tag, boost::units::detail::static_rati
|
||||
};
|
||||
};
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<>
|
||||
struct divides_impl<boost::units::scale_dim_tag, boost::units::detail::static_rational_tag>
|
||||
{
|
||||
template<class T0, class T1>
|
||||
struct apply
|
||||
{
|
||||
typedef boost::units::scale_list_dim<
|
||||
boost::units::scale<
|
||||
(T0::base),
|
||||
typename mpl::divides<typename T0::exponent, T1>::type
|
||||
>
|
||||
> type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace mpl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -669,17 +669,18 @@ template<class T>
|
||||
struct autoprefix_norm_impl<T, true>
|
||||
{
|
||||
typedef double type;
|
||||
static double call(const T& arg) { return std::abs(arg); }
|
||||
static BOOST_CONSTEXPR double call(const T& arg) { return std::abs(arg); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct autoprefix_norm_impl<T, false>
|
||||
{
|
||||
typedef one type;
|
||||
static one call(const T&) { return one(); }
|
||||
static BOOST_CONSTEXPR one call(const T&) { return one(); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
BOOST_CONSTEXPR
|
||||
typename autoprefix_norm_impl<T>::type autoprefix_norm(const T& arg)
|
||||
{
|
||||
return autoprefix_norm_impl<T>::call(arg);
|
||||
@@ -690,12 +691,14 @@ typename autoprefix_norm_impl<T>::type autoprefix_norm(const T& arg)
|
||||
namespace detail {
|
||||
|
||||
template<class End, class Prev, class T, class F>
|
||||
BOOST_CONSTEXPR
|
||||
bool find_matching_scale_impl(End, End, Prev, T, double, F)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Begin, class End, class Prev, class T, class F>
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
bool find_matching_scale_impl(Begin, End end, Prev prev, T t, double x, F f)
|
||||
{
|
||||
if(Begin::item::value() > x) {
|
||||
@@ -714,12 +717,14 @@ bool find_matching_scale_impl(Begin, End end, Prev prev, T t, double x, F f)
|
||||
}
|
||||
|
||||
template<class End, class T, class F>
|
||||
BOOST_CONSTEXPR
|
||||
bool find_matching_scale_i(End, End, T, double, F)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class Begin, class End, class T, class F>
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
bool find_matching_scale_i(Begin, End end, T t, double x, F f)
|
||||
{
|
||||
if(Begin::item::value() > x) {
|
||||
@@ -730,6 +735,7 @@ bool find_matching_scale_i(Begin, End end, T t, double x, F f)
|
||||
}
|
||||
|
||||
template<class Scales, class T, class F>
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
bool find_matching_scale(T t, double x, F f)
|
||||
{
|
||||
return detail::find_matching_scale_i(Scales(), dimensionless_type(), t, x, f);
|
||||
@@ -976,8 +982,8 @@ void maybe_print_prefixed(std::basic_ostream<CharT, Traits>& os, const quantity<
|
||||
detail::print_default(os, q)();
|
||||
}
|
||||
|
||||
inline mpl::true_ test_norm(double) { return mpl::true_(); }
|
||||
inline mpl::false_ test_norm(one) { return mpl::false_(); }
|
||||
inline BOOST_CONSTEXPR mpl::true_ test_norm(double) { return mpl::true_(); }
|
||||
inline BOOST_CONSTEXPR mpl::false_ test_norm(one) { return mpl::false_(); }
|
||||
|
||||
} // namespace detail
|
||||
|
||||
|
||||
@@ -28,46 +28,46 @@ class numeric_limits< ::boost::units::quantity<Unit, T> >
|
||||
{
|
||||
public:
|
||||
typedef ::boost::units::quantity<Unit, T> quantity_type;
|
||||
static const bool is_specialized = std::numeric_limits<T>::is_specialized;
|
||||
static quantity_type (min)() { return(quantity_type::from_value((std::numeric_limits<T>::min)())); }
|
||||
static quantity_type (max)() { return(quantity_type::from_value((std::numeric_limits<T>::max)())); }
|
||||
BOOST_STATIC_CONSTEXPR bool is_specialized = std::numeric_limits<T>::is_specialized;
|
||||
static BOOST_CONSTEXPR quantity_type (min)() { return(quantity_type::from_value((std::numeric_limits<T>::min)())); }
|
||||
static BOOST_CONSTEXPR quantity_type (max)() { return(quantity_type::from_value((std::numeric_limits<T>::max)())); }
|
||||
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
static quantity_type (lowest)() { return(quantity_type::from_value((std::numeric_limits<T>::lowest)())); }
|
||||
static BOOST_CONSTEXPR quantity_type (lowest)() { return(quantity_type::from_value((std::numeric_limits<T>::lowest)())); }
|
||||
#endif
|
||||
static const int digits = std::numeric_limits<T>::digits;
|
||||
static const int digits10 = std::numeric_limits<T>::digits10;
|
||||
BOOST_STATIC_CONSTEXPR int digits = std::numeric_limits<T>::digits;
|
||||
BOOST_STATIC_CONSTEXPR int digits10 = std::numeric_limits<T>::digits10;
|
||||
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
static const int max_digits10 = std::numeric_limits<T>::max_digits10;
|
||||
BOOST_STATIC_CONSTEXPR int max_digits10 = std::numeric_limits<T>::max_digits10;
|
||||
#endif
|
||||
static const bool is_signed = std::numeric_limits<T>::is_signed;
|
||||
static const bool is_integer = std::numeric_limits<T>::is_integer;
|
||||
static const bool is_exact = std::numeric_limits<T>::is_exact;
|
||||
static const int radix = std::numeric_limits<T>::radix;
|
||||
static quantity_type epsilon() { return(quantity_type::from_value(std::numeric_limits<T>::epsilon())); }
|
||||
static quantity_type round_error() { return(quantity_type::from_value(std::numeric_limits<T>::round_error())); }
|
||||
static const int min_exponent = std::numeric_limits<T>::min_exponent;
|
||||
static const int min_exponent10 = std::numeric_limits<T>::min_exponent10;
|
||||
static const int max_exponent = std::numeric_limits<T>::max_exponent;
|
||||
static const int max_exponent10 = std::numeric_limits<T>::max_exponent10;
|
||||
static const bool has_infinity = std::numeric_limits<T>::has_infinity;
|
||||
static const bool has_quiet_NaN = std::numeric_limits<T>::has_quiet_NaN;
|
||||
static const bool has_signaling_NaN = std::numeric_limits<T>::has_signaling_NaN;
|
||||
static const bool has_denorm_loss = std::numeric_limits<T>::has_denorm_loss;
|
||||
static quantity_type infinity() { return(quantity_type::from_value(std::numeric_limits<T>::infinity())); }
|
||||
static quantity_type quiet_NaN() { return(quantity_type::from_value(std::numeric_limits<T>::quiet_NaN())); }
|
||||
static quantity_type signaling_NaN() { return(quantity_type::from_value(std::numeric_limits<T>::signaling_NaN())); }
|
||||
static quantity_type denorm_min() { return(quantity_type::from_value(std::numeric_limits<T>::denorm_min())); }
|
||||
static const bool is_iec559 = std::numeric_limits<T>::is_iec559;
|
||||
static const bool is_bounded = std::numeric_limits<T>::is_bounded;
|
||||
static const bool is_modulo = std::numeric_limits<T>::is_modulo;
|
||||
static const bool traps = std::numeric_limits<T>::traps;
|
||||
static const bool tinyness_before = std::numeric_limits<T>::tinyness_before;
|
||||
BOOST_STATIC_CONSTEXPR bool is_signed = std::numeric_limits<T>::is_signed;
|
||||
BOOST_STATIC_CONSTEXPR bool is_integer = std::numeric_limits<T>::is_integer;
|
||||
BOOST_STATIC_CONSTEXPR bool is_exact = std::numeric_limits<T>::is_exact;
|
||||
BOOST_STATIC_CONSTEXPR int radix = std::numeric_limits<T>::radix;
|
||||
static BOOST_CONSTEXPR quantity_type epsilon() { return(quantity_type::from_value(std::numeric_limits<T>::epsilon())); }
|
||||
static BOOST_CONSTEXPR quantity_type round_error() { return(quantity_type::from_value(std::numeric_limits<T>::round_error())); }
|
||||
BOOST_STATIC_CONSTEXPR int min_exponent = std::numeric_limits<T>::min_exponent;
|
||||
BOOST_STATIC_CONSTEXPR int min_exponent10 = std::numeric_limits<T>::min_exponent10;
|
||||
BOOST_STATIC_CONSTEXPR int max_exponent = std::numeric_limits<T>::max_exponent;
|
||||
BOOST_STATIC_CONSTEXPR int max_exponent10 = std::numeric_limits<T>::max_exponent10;
|
||||
BOOST_STATIC_CONSTEXPR bool has_infinity = std::numeric_limits<T>::has_infinity;
|
||||
BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = std::numeric_limits<T>::has_quiet_NaN;
|
||||
BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = std::numeric_limits<T>::has_signaling_NaN;
|
||||
BOOST_STATIC_CONSTEXPR bool has_denorm_loss = std::numeric_limits<T>::has_denorm_loss;
|
||||
static BOOST_CONSTEXPR quantity_type infinity() { return(quantity_type::from_value(std::numeric_limits<T>::infinity())); }
|
||||
static BOOST_CONSTEXPR quantity_type quiet_NaN() { return(quantity_type::from_value(std::numeric_limits<T>::quiet_NaN())); }
|
||||
static BOOST_CONSTEXPR quantity_type signaling_NaN() { return(quantity_type::from_value(std::numeric_limits<T>::signaling_NaN())); }
|
||||
static BOOST_CONSTEXPR quantity_type denorm_min() { return(quantity_type::from_value(std::numeric_limits<T>::denorm_min())); }
|
||||
BOOST_STATIC_CONSTEXPR bool is_iec559 = std::numeric_limits<T>::is_iec559;
|
||||
BOOST_STATIC_CONSTEXPR bool is_bounded = std::numeric_limits<T>::is_bounded;
|
||||
BOOST_STATIC_CONSTEXPR bool is_modulo = std::numeric_limits<T>::is_modulo;
|
||||
BOOST_STATIC_CONSTEXPR bool traps = std::numeric_limits<T>::traps;
|
||||
BOOST_STATIC_CONSTEXPR bool tinyness_before = std::numeric_limits<T>::tinyness_before;
|
||||
#if defined(_STLP_STATIC_CONST_INIT_BUG)
|
||||
static const int has_denorm = std::numeric_limits<T>::has_denorm;
|
||||
static const int round_style = std::numeric_limits<T>::round_style;
|
||||
BOOST_STATIC_CONSTEXPR int has_denorm = std::numeric_limits<T>::has_denorm;
|
||||
BOOST_STATIC_CONSTEXPR int round_style = std::numeric_limits<T>::round_style;
|
||||
#else
|
||||
static const float_denorm_style has_denorm = std::numeric_limits<T>::has_denorm;
|
||||
static const float_round_style round_style = std::numeric_limits<T>::round_style;
|
||||
BOOST_STATIC_CONSTEXPR float_denorm_style has_denorm = std::numeric_limits<T>::has_denorm;
|
||||
BOOST_STATIC_CONSTEXPR float_round_style round_style = std::numeric_limits<T>::round_style;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ struct power_typeof_helper
|
||||
/// specifies the result type
|
||||
typedef detail::unspecified type;
|
||||
/// Carries out the runtime calculation.
|
||||
static type value(const BaseType& base);
|
||||
static BOOST_CONSTEXPR type value(const BaseType& base);
|
||||
};
|
||||
|
||||
/// A helper used by @c root to take a root
|
||||
@@ -152,7 +152,7 @@ struct root_typeof_helper
|
||||
/// specifies the result type
|
||||
typedef detail::unspecified type;
|
||||
/// Carries out the runtime calculation.
|
||||
static type value(const Radicand& base);
|
||||
static BOOST_CONSTEXPR type value(const Radicand& base);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#ifndef BOOST_UNITS_POW_HPP
|
||||
#define BOOST_UNITS_POW_HPP
|
||||
|
||||
#include <boost/math_fwd.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
|
||||
#include <boost/units/operators.hpp>
|
||||
@@ -27,6 +26,7 @@ namespace units {
|
||||
|
||||
/// raise a value to a @c static_rational power.
|
||||
template<class Rat,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
inline typename power_typeof_helper<Y,Rat>::type
|
||||
pow(const Y& x)
|
||||
{
|
||||
@@ -35,6 +35,7 @@ pow(const Y& x)
|
||||
|
||||
/// raise a value to an integer power.
|
||||
template<long N,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
inline typename power_typeof_helper<Y,static_rational<N> >::type
|
||||
pow(const Y& x)
|
||||
{
|
||||
@@ -51,7 +52,7 @@ struct power_typeof_helper<T, static_rational<N,D> >
|
||||
typedef detail::static_rational_power_impl<static_rational<N, D>, internal_type> impl;
|
||||
typedef typename impl::type type;
|
||||
|
||||
static type value(const T& x)
|
||||
static BOOST_CONSTEXPR type value(const T& x)
|
||||
{
|
||||
return impl::call(x);
|
||||
}
|
||||
@@ -64,7 +65,7 @@ struct power_typeof_helper<float, static_rational<N,D> >
|
||||
// N.B. pathscale doesn't accept inheritance for some reason.
|
||||
typedef power_typeof_helper<double, static_rational<N,D> > base;
|
||||
typedef typename base::type type;
|
||||
static type value(const double& x)
|
||||
static BOOST_CONSTEXPR type value(const double& x)
|
||||
{
|
||||
return base::value(x);
|
||||
}
|
||||
@@ -74,6 +75,7 @@ struct power_typeof_helper<float, static_rational<N,D> >
|
||||
|
||||
/// take the @c static_rational root of a value.
|
||||
template<class Rat,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename root_typeof_helper<Y,Rat>::type
|
||||
root(const Y& x)
|
||||
{
|
||||
@@ -82,6 +84,7 @@ root(const Y& x)
|
||||
|
||||
/// take the integer root of a value.
|
||||
template<long N,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename root_typeof_helper<Y,static_rational<N> >::type
|
||||
root(const Y& x)
|
||||
{
|
||||
@@ -97,7 +100,7 @@ struct root_typeof_helper<T,static_rational<N,D> >
|
||||
// N.B. pathscale doesn't accept inheritance for some reason.
|
||||
typedef power_typeof_helper<T, static_rational<D,N> > base;
|
||||
typedef typename base::type type;
|
||||
static type value(const T& x)
|
||||
static BOOST_CONSTEXPR type value(const T& x)
|
||||
{
|
||||
return(base::value(x));
|
||||
}
|
||||
|
||||
@@ -98,17 +98,17 @@ class quantity
|
||||
typedef Y value_type;
|
||||
typedef Unit unit_type;
|
||||
|
||||
quantity() : val_()
|
||||
BOOST_CONSTEXPR quantity() : val_()
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
}
|
||||
|
||||
quantity(unspecified_null_pointer_constant_type) : val_()
|
||||
BOOST_CONSTEXPR quantity(unspecified_null_pointer_constant_type) : val_()
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
}
|
||||
|
||||
quantity(const this_type& source) : val_(source.val_)
|
||||
BOOST_CONSTEXPR quantity(const this_type& source) : val_(source.val_)
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class quantity
|
||||
|
||||
//~quantity() { }
|
||||
|
||||
this_type& operator=(const this_type& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const this_type& source)
|
||||
{
|
||||
val_ = source.val_;
|
||||
|
||||
@@ -135,7 +135,7 @@ class quantity
|
||||
|
||||
/// implicit conversion between value types is allowed if allowed for value types themselves
|
||||
template<class YY>
|
||||
quantity(const quantity<Unit,YY>& source,
|
||||
BOOST_CONSTEXPR quantity(const quantity<Unit,YY>& source,
|
||||
typename boost::enable_if<detail::is_non_narrowing_conversion<YY, Y> >::type* = 0) :
|
||||
val_(source.value())
|
||||
{
|
||||
@@ -144,7 +144,7 @@ class quantity
|
||||
|
||||
/// implicit conversion between value types is not allowed if not allowed for value types themselves
|
||||
template<class YY>
|
||||
explicit quantity(const quantity<Unit,YY>& source,
|
||||
explicit BOOST_CONSTEXPR quantity(const quantity<Unit,YY>& source,
|
||||
typename boost::disable_if<detail::is_non_narrowing_conversion<YY, Y> >::type* = 0) :
|
||||
val_(static_cast<Y>(source.value()))
|
||||
{
|
||||
@@ -155,7 +155,7 @@ class quantity
|
||||
|
||||
/// implicit conversion between value types is allowed if allowed for value types themselves
|
||||
template<class YY>
|
||||
quantity(const quantity<Unit,YY>& source) :
|
||||
BOOST_CONSTEXPR quantity(const quantity<Unit,YY>& source) :
|
||||
val_(source.value())
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
@@ -166,7 +166,7 @@ class quantity
|
||||
|
||||
/// implicit assignment between value types is allowed if allowed for value types themselves
|
||||
template<class YY>
|
||||
this_type& operator=(const quantity<Unit,YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const quantity<Unit,YY>& source)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<YY, Y>::value == true));
|
||||
|
||||
@@ -180,7 +180,7 @@ class quantity
|
||||
/// explicit conversion between different unit systems is allowed if implicit conversion is disallowed
|
||||
template<class Unit2,class YY>
|
||||
explicit
|
||||
quantity(const quantity<Unit2,YY>& source,
|
||||
BOOST_CONSTEXPR quantity(const quantity<Unit2,YY>& source,
|
||||
typename boost::disable_if<
|
||||
mpl::and_<
|
||||
//is_implicitly_convertible should be undefined when the
|
||||
@@ -198,7 +198,7 @@ class quantity
|
||||
|
||||
/// implicit conversion between different unit systems is allowed if each fundamental dimension is implicitly convertible
|
||||
template<class Unit2,class YY>
|
||||
quantity(const quantity<Unit2,YY>& source,
|
||||
BOOST_CONSTEXPR quantity(const quantity<Unit2,YY>& source,
|
||||
typename boost::enable_if<
|
||||
mpl::and_<
|
||||
typename is_implicitly_convertible<Unit2,Unit>::type,
|
||||
@@ -217,7 +217,7 @@ class quantity
|
||||
/// without SFINAE we can't distinguish between explicit and implicit conversions so
|
||||
/// the conversion is always explicit
|
||||
template<class Unit2,class YY>
|
||||
explicit quantity(const quantity<Unit2,YY>& source)
|
||||
explicit BOOST_CONSTEXPR quantity(const quantity<Unit2,YY>& source)
|
||||
: val_(conversion_helper<quantity<Unit2,YY>,this_type>::convert(source).value())
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
@@ -228,7 +228,7 @@ class quantity
|
||||
|
||||
/// implicit assignment between different unit systems is allowed if each fundamental dimension is implicitly convertible
|
||||
template<class Unit2,class YY>
|
||||
this_type& operator=(const quantity<Unit2,YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const quantity<Unit2,YY>& source)
|
||||
{
|
||||
|
||||
BOOST_STATIC_ASSERT((is_implicitly_convertible<Unit2,unit_type>::value == true));
|
||||
@@ -239,11 +239,11 @@ class quantity
|
||||
return *this;
|
||||
}
|
||||
|
||||
const value_type& value() const { return val_; } ///< constant accessor to value
|
||||
BOOST_CONSTEXPR const value_type& value() const { return val_; } ///< constant accessor to value
|
||||
|
||||
///< can add a quantity of the same type if add_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
template<class Unit2, class YY>
|
||||
this_type& operator+=(const quantity<Unit2, YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator+=(const quantity<Unit2, YY>& source)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename add_typeof_helper<Unit, Unit2>::type, Unit>::value));
|
||||
val_ += source.value();
|
||||
@@ -252,7 +252,7 @@ class quantity
|
||||
|
||||
///< can subtract a quantity of the same type if subtract_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
template<class Unit2, class YY>
|
||||
this_type& operator-=(const quantity<Unit2, YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator-=(const quantity<Unit2, YY>& source)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename subtract_typeof_helper<Unit, Unit2>::type, Unit>::value));
|
||||
val_ -= source.value();
|
||||
@@ -260,7 +260,7 @@ class quantity
|
||||
}
|
||||
|
||||
template<class Unit2, class YY>
|
||||
this_type& operator*=(const quantity<Unit2, YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator*=(const quantity<Unit2, YY>& source)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename multiply_typeof_helper<Unit, Unit2>::type, Unit>::value));
|
||||
val_ *= source.value();
|
||||
@@ -268,7 +268,7 @@ class quantity
|
||||
}
|
||||
|
||||
template<class Unit2, class YY>
|
||||
this_type& operator/=(const quantity<Unit2, YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator/=(const quantity<Unit2, YY>& source)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_same<typename divide_typeof_helper<Unit, Unit2>::type, Unit>::value));
|
||||
val_ /= source.value();
|
||||
@@ -276,15 +276,15 @@ class quantity
|
||||
}
|
||||
|
||||
///< can multiply a quantity by a scalar value_type if multiply_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
this_type& operator*=(const value_type& source) { val_ *= source; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator*=(const value_type& source) { val_ *= source; return *this; }
|
||||
///< can divide a quantity by a scalar value_type if divide_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
this_type& operator/=(const value_type& source) { val_ /= source; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator/=(const value_type& source) { val_ /= source; return *this; }
|
||||
|
||||
/// Construct quantity directly from @c value_type (potentially dangerous).
|
||||
static this_type from_value(const value_type& val) { return this_type(val, 0); }
|
||||
static BOOST_CONSTEXPR this_type from_value(const value_type& val) { return this_type(val, 0); }
|
||||
|
||||
protected:
|
||||
explicit quantity(const value_type& val, int) : val_(val) { }
|
||||
explicit BOOST_CONSTEXPR quantity(const value_type& val, int) : val_(val) { }
|
||||
|
||||
private:
|
||||
value_type val_;
|
||||
@@ -305,25 +305,25 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
typedef dimensionless_type dimension_type;
|
||||
typedef unit<dimension_type,system_type> unit_type;
|
||||
|
||||
quantity() : val_()
|
||||
BOOST_CONSTEXPR quantity() : val_()
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
}
|
||||
|
||||
/// construction from raw @c value_type is allowed
|
||||
quantity(value_type val) : val_(val)
|
||||
BOOST_CONSTEXPR quantity(value_type val) : val_(val)
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
}
|
||||
|
||||
quantity(const this_type& source) : val_(source.val_)
|
||||
BOOST_CONSTEXPR quantity(const this_type& source) : val_(source.val_)
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
}
|
||||
|
||||
//~quantity() { }
|
||||
|
||||
this_type& operator=(const this_type& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const this_type& source)
|
||||
{
|
||||
val_ = source.val_;
|
||||
|
||||
@@ -334,7 +334,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit conversion between value types is allowed if allowed for value types themselves
|
||||
template<class YY>
|
||||
quantity(const quantity<unit<dimension_type,system_type>,YY>& source,
|
||||
BOOST_CONSTEXPR quantity(const quantity<unit<dimension_type,system_type>,YY>& source,
|
||||
typename boost::enable_if<detail::is_non_narrowing_conversion<YY, Y> >::type* = 0) :
|
||||
val_(source.value())
|
||||
{
|
||||
@@ -343,7 +343,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit conversion between value types is not allowed if not allowed for value types themselves
|
||||
template<class YY>
|
||||
explicit quantity(const quantity<unit<dimension_type,system_type>,YY>& source,
|
||||
explicit BOOST_CONSTEXPR quantity(const quantity<unit<dimension_type,system_type>,YY>& source,
|
||||
typename boost::disable_if<detail::is_non_narrowing_conversion<YY, Y> >::type* = 0) :
|
||||
val_(static_cast<Y>(source.value()))
|
||||
{
|
||||
@@ -354,7 +354,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit conversion between value types is allowed if allowed for value types themselves
|
||||
template<class YY>
|
||||
quantity(const quantity<unit<dimension_type,system_type>,YY>& source) :
|
||||
BOOST_CONSTEXPR quantity(const quantity<unit<dimension_type,system_type>,YY>& source) :
|
||||
val_(source.value())
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
@@ -365,7 +365,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit assignment between value types is allowed if allowed for value types themselves
|
||||
template<class YY>
|
||||
this_type& operator=(const quantity<unit<dimension_type,system_type>,YY>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const quantity<unit<dimension_type,system_type>,YY>& source)
|
||||
{
|
||||
BOOST_STATIC_ASSERT((boost::is_convertible<YY,Y>::value == true));
|
||||
|
||||
@@ -378,7 +378,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit conversion between different unit systems is allowed
|
||||
template<class System2, class Y2>
|
||||
quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
|
||||
BOOST_CONSTEXPR quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
|
||||
#ifdef __SUNPRO_CC
|
||||
typename boost::enable_if<
|
||||
boost::mpl::and_<
|
||||
@@ -399,7 +399,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit conversion between different unit systems is allowed
|
||||
template<class System2, class Y2>
|
||||
explicit quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
|
||||
explicit BOOST_CONSTEXPR quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
|
||||
#ifdef __SUNPRO_CC
|
||||
typename boost::enable_if<
|
||||
boost::mpl::and_<
|
||||
@@ -422,7 +422,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit conversion between different unit systems is allowed
|
||||
template<class System2, class Y2>
|
||||
quantity(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y2>& source) :
|
||||
BOOST_CONSTEXPR quantity(const quantity<unit<dimensionless_type,homogeneous_system<System2> >,Y2>& source) :
|
||||
val_(source.value())
|
||||
{
|
||||
BOOST_UNITS_CHECK_LAYOUT_COMPATIBILITY(this_type, Y);
|
||||
@@ -434,7 +434,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
/// conversion between different unit systems is explicit when
|
||||
/// the units are not equivalent.
|
||||
template<class System2, class Y2>
|
||||
explicit quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
|
||||
explicit BOOST_CONSTEXPR quantity(const quantity<unit<dimensionless_type, System2>,Y2>& source,
|
||||
typename boost::disable_if<detail::is_dimensionless_system<System2> >::type* = 0) :
|
||||
val_(conversion_helper<quantity<unit<dimensionless_type, System2>,Y2>, this_type>::convert(source).value())
|
||||
{
|
||||
@@ -445,7 +445,7 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
|
||||
/// implicit assignment between different unit systems is allowed
|
||||
template<class System2>
|
||||
this_type& operator=(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System2),Y>& source)
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System2),Y>& source)
|
||||
{
|
||||
*this = this_type(source);
|
||||
|
||||
@@ -455,24 +455,24 @@ class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System),Y>
|
||||
#endif
|
||||
|
||||
/// implicit conversion to @c value_type is allowed
|
||||
operator value_type() const { return val_; }
|
||||
BOOST_CONSTEXPR operator value_type() const { return val_; }
|
||||
|
||||
const value_type& value() const { return val_; } ///< constant accessor to value
|
||||
BOOST_CONSTEXPR const value_type& value() const { return val_; } ///< constant accessor to value
|
||||
|
||||
///< can add a quantity of the same type if add_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
this_type& operator+=(const this_type& source) { val_ += source.val_; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator+=(const this_type& source) { val_ += source.val_; return *this; }
|
||||
|
||||
///< can subtract a quantity of the same type if subtract_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
this_type& operator-=(const this_type& source) { val_ -= source.val_; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator-=(const this_type& source) { val_ -= source.val_; return *this; }
|
||||
|
||||
///< can multiply a quantity by a scalar value_type if multiply_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
this_type& operator*=(const value_type& val) { val_ *= val; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator*=(const value_type& val) { val_ *= val; return *this; }
|
||||
|
||||
///< can divide a quantity by a scalar value_type if divide_typeof_helper<value_type,value_type>::type is convertible to value_type
|
||||
this_type& operator/=(const value_type& val) { val_ /= val; return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator/=(const value_type& val) { val_ /= val; return *this; }
|
||||
|
||||
/// Construct quantity directly from @c value_type.
|
||||
static this_type from_value(const value_type& val) { return this_type(val); }
|
||||
static BOOST_CONSTEXPR this_type from_value(const value_type& val) { return this_type(val); }
|
||||
|
||||
private:
|
||||
value_type val_;
|
||||
@@ -513,7 +513,7 @@ struct quantity_cast_helper<Y,quantity<Unit,X> >
|
||||
{
|
||||
typedef Y type;
|
||||
|
||||
type operator()(quantity<Unit,X>& source) { return const_cast<X&>(source.value()); }
|
||||
BOOST_CONSTEXPR type operator()(quantity<Unit,X>& source) const { return const_cast<X&>(source.value()); }
|
||||
};
|
||||
|
||||
/// specialization for casting to the value type
|
||||
@@ -522,7 +522,7 @@ struct quantity_cast_helper<Y,const quantity<Unit,X> >
|
||||
{
|
||||
typedef Y type;
|
||||
|
||||
type operator()(const quantity<Unit,X>& source) { return source.value(); }
|
||||
BOOST_CONSTEXPR type operator()(const quantity<Unit,X>& source) const { return source.value(); }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
@@ -530,22 +530,20 @@ struct quantity_cast_helper<Y,const quantity<Unit,X> >
|
||||
/// quantity_cast provides mutating access to underlying quantity value_type
|
||||
template<class X,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
X
|
||||
quantity_cast(Y& source)
|
||||
{
|
||||
detail::quantity_cast_helper<X,Y> qch;
|
||||
|
||||
return qch(source);
|
||||
return detail::quantity_cast_helper<X,Y>()(source);
|
||||
}
|
||||
|
||||
template<class X,class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
X
|
||||
quantity_cast(const Y& source)
|
||||
{
|
||||
detail::quantity_cast_helper<X,const Y> qch;
|
||||
|
||||
return qch(source);
|
||||
return detail::quantity_cast_helper<X,const Y>()(source);
|
||||
}
|
||||
|
||||
/// swap quantities
|
||||
@@ -863,7 +861,7 @@ struct power_typeof_helper< quantity<Unit,Y>,static_rational<N,D> >
|
||||
typedef typename power_typeof_helper<Unit,static_rational<N,D> >::type unit_type;
|
||||
typedef quantity<unit_type,value_type> type;
|
||||
|
||||
static type value(const quantity<Unit,Y>& x)
|
||||
static BOOST_CONSTEXPR type value(const quantity<Unit,Y>& x)
|
||||
{
|
||||
return type::from_value(power_typeof_helper<Y,static_rational<N,D> >::value(x.value()));
|
||||
}
|
||||
@@ -878,7 +876,7 @@ struct root_typeof_helper< quantity<Unit,Y>,static_rational<N,D> >
|
||||
typedef typename root_typeof_helper<Unit,static_rational<N,D> >::type unit_type;
|
||||
typedef quantity<unit_type,value_type> type;
|
||||
|
||||
static type value(const quantity<Unit,Y>& x)
|
||||
static BOOST_CONSTEXPR type value(const quantity<Unit,Y>& x)
|
||||
{
|
||||
return type::from_value(root_typeof_helper<Y,static_rational<N,D> >::value(x.value()));
|
||||
}
|
||||
@@ -890,6 +888,7 @@ template<class System,
|
||||
class Dim,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< unit<Dim,System>,Y >::type
|
||||
operator*(const unit<Dim,System>&,const Y& rhs)
|
||||
{
|
||||
@@ -903,6 +902,7 @@ template<class System,
|
||||
class Dim,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< unit<Dim,System>,Y >::type
|
||||
operator/(const unit<Dim,System>&,const Y& rhs)
|
||||
{
|
||||
@@ -916,6 +916,7 @@ template<class System,
|
||||
class Dim,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< Y,unit<Dim,System> >::type
|
||||
operator*(const Y& lhs,const unit<Dim,System>&)
|
||||
{
|
||||
@@ -929,6 +930,7 @@ template<class System,
|
||||
class Dim,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< Y,unit<Dim,System> >::type
|
||||
operator/(const Y& lhs,const unit<Dim,System>&)
|
||||
{
|
||||
@@ -942,6 +944,7 @@ operator/(const Y& lhs,const unit<Dim,System>&)
|
||||
// class X,
|
||||
// class Y>
|
||||
//inline
|
||||
//BOOST_CONSTEXPR
|
||||
//typename multiply_typeof_helper< quantity<Unit,X>,Y >::type
|
||||
//operator*(const quantity<Unit,X>& lhs,const Y& rhs)
|
||||
//{
|
||||
@@ -955,6 +958,7 @@ operator/(const Y& lhs,const unit<Dim,System>&)
|
||||
// class X,
|
||||
// class Y>
|
||||
//inline
|
||||
//BOOST_CONSTEXPR
|
||||
//typename multiply_typeof_helper< X,quantity<Unit,Y> >::type
|
||||
//operator*(const X& lhs,const quantity<Unit,Y>& rhs)
|
||||
//{
|
||||
@@ -967,6 +971,7 @@ operator/(const Y& lhs,const unit<Dim,System>&)
|
||||
template<class Unit,
|
||||
class X>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< quantity<Unit,X>,X >::type
|
||||
operator*(const quantity<Unit,X>& lhs,const X& rhs)
|
||||
{
|
||||
@@ -979,6 +984,7 @@ operator*(const quantity<Unit,X>& lhs,const X& rhs)
|
||||
template<class Unit,
|
||||
class X>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< X,quantity<Unit,X> >::type
|
||||
operator*(const X& lhs,const quantity<Unit,X>& rhs)
|
||||
{
|
||||
@@ -992,6 +998,7 @@ operator*(const X& lhs,const quantity<Unit,X>& rhs)
|
||||
// class X,
|
||||
// class Y>
|
||||
//inline
|
||||
//BOOST_CONSTEXPR
|
||||
//typename divide_typeof_helper< quantity<Unit,X>,Y >::type
|
||||
//operator/(const quantity<Unit,X>& lhs,const Y& rhs)
|
||||
//{
|
||||
@@ -1005,6 +1012,7 @@ operator*(const X& lhs,const quantity<Unit,X>& rhs)
|
||||
// class X,
|
||||
// class Y>
|
||||
//inline
|
||||
//BOOST_CONSTEXPR
|
||||
//typename divide_typeof_helper< X,quantity<Unit,Y> >::type
|
||||
//operator/(const X& lhs,const quantity<Unit,Y>& rhs)
|
||||
//{
|
||||
@@ -1017,6 +1025,7 @@ operator*(const X& lhs,const quantity<Unit,X>& rhs)
|
||||
template<class Unit,
|
||||
class X>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< quantity<Unit,X>,X >::type
|
||||
operator/(const quantity<Unit,X>& lhs,const X& rhs)
|
||||
{
|
||||
@@ -1029,6 +1038,7 @@ operator/(const quantity<Unit,X>& lhs,const X& rhs)
|
||||
template<class Unit,
|
||||
class X>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< X,quantity<Unit,X> >::type
|
||||
operator/(const X& lhs,const quantity<Unit,X>& rhs)
|
||||
{
|
||||
@@ -1043,6 +1053,7 @@ template<class System1,
|
||||
class Unit2,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< unit<Dim1,System1>,quantity<Unit2,Y> >::type
|
||||
operator*(const unit<Dim1,System1>&,const quantity<Unit2,Y>& rhs)
|
||||
{
|
||||
@@ -1057,6 +1068,7 @@ template<class System1,
|
||||
class Unit2,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< unit<Dim1,System1>,quantity<Unit2,Y> >::type
|
||||
operator/(const unit<Dim1,System1>&,const quantity<Unit2,Y>& rhs)
|
||||
{
|
||||
@@ -1071,6 +1083,7 @@ template<class Unit1,
|
||||
class Dim2,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< quantity<Unit1,Y>,unit<Dim2,System2> >::type
|
||||
operator*(const quantity<Unit1,Y>& lhs,const unit<Dim2,System2>&)
|
||||
{
|
||||
@@ -1085,6 +1098,7 @@ template<class Unit1,
|
||||
class Dim2,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< quantity<Unit1,Y>,unit<Dim2,System2> >::type
|
||||
operator/(const quantity<Unit1,Y>& lhs,const unit<Dim2,System2>&)
|
||||
{
|
||||
@@ -1095,6 +1109,7 @@ operator/(const quantity<Unit1,Y>& lhs,const unit<Dim2,System2>&)
|
||||
|
||||
/// runtime unary plus quantity
|
||||
template<class Unit,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename unary_plus_typeof_helper< quantity<Unit,Y> >::type
|
||||
operator+(const quantity<Unit,Y>& val)
|
||||
{
|
||||
@@ -1105,6 +1120,7 @@ operator+(const quantity<Unit,Y>& val)
|
||||
|
||||
/// runtime unary minus quantity
|
||||
template<class Unit,class Y>
|
||||
BOOST_CONSTEXPR
|
||||
typename unary_minus_typeof_helper< quantity<Unit,Y> >::type
|
||||
operator-(const quantity<Unit,Y>& val)
|
||||
{
|
||||
@@ -1119,6 +1135,7 @@ template<class Unit1,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename add_typeof_helper< quantity<Unit1,X>,quantity<Unit2,Y> >::type
|
||||
operator+(const quantity<Unit1,X>& lhs,
|
||||
const quantity<Unit2,Y>& rhs)
|
||||
@@ -1134,6 +1151,7 @@ template<class Unit1,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename subtract_typeof_helper< quantity<Unit1,X>,quantity<Unit2,Y> >::type
|
||||
operator-(const quantity<Unit1,X>& lhs,
|
||||
const quantity<Unit2,Y>& rhs)
|
||||
@@ -1149,6 +1167,7 @@ template<class Unit1,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< quantity<Unit1,X>,quantity<Unit2,Y> >::type
|
||||
operator*(const quantity<Unit1,X>& lhs,
|
||||
const quantity<Unit2,Y>& rhs)
|
||||
@@ -1165,6 +1184,7 @@ template<class Unit1,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< quantity<Unit1,X>,quantity<Unit2,Y> >::type
|
||||
operator/(const quantity<Unit1,X>& lhs,
|
||||
const quantity<Unit2,Y>& rhs)
|
||||
@@ -1180,6 +1200,7 @@ template<class Unit,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator==(const quantity<Unit,X>& val1,
|
||||
const quantity<Unit,Y>& val2)
|
||||
@@ -1192,6 +1213,7 @@ template<class Unit,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator!=(const quantity<Unit,X>& val1,
|
||||
const quantity<Unit,Y>& val2)
|
||||
@@ -1204,6 +1226,7 @@ template<class Unit,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator<(const quantity<Unit,X>& val1,
|
||||
const quantity<Unit,Y>& val2)
|
||||
@@ -1216,6 +1239,7 @@ template<class Unit,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator<=(const quantity<Unit,X>& val1,
|
||||
const quantity<Unit,Y>& val2)
|
||||
@@ -1228,6 +1252,7 @@ template<class Unit,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator>(const quantity<Unit,X>& val1,
|
||||
const quantity<Unit,Y>& val2)
|
||||
@@ -1240,6 +1265,7 @@ template<class Unit,
|
||||
class X,
|
||||
class Y>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator>=(const quantity<Unit,X>& val1,
|
||||
const quantity<Unit,Y>& val2)
|
||||
|
||||
@@ -37,10 +37,10 @@ struct scaled_base_unit;
|
||||
template<long Base, class Exponent>
|
||||
struct scale
|
||||
{
|
||||
static const long base = Base;
|
||||
BOOST_STATIC_CONSTEXPR long base = Base;
|
||||
typedef Exponent exponent;
|
||||
typedef double value_type;
|
||||
static value_type value() { return(detail::static_rational_power<Exponent>(static_cast<double>(base))); }
|
||||
static BOOST_CONSTEXPR value_type value() { return(detail::static_rational_power<Exponent>(static_cast<double>(base))); }
|
||||
// These need to be defined in specializations for
|
||||
// printing to work.
|
||||
// static std::string name();
|
||||
@@ -48,22 +48,22 @@ struct scale
|
||||
};
|
||||
|
||||
template<long Base, class Exponent>
|
||||
const long scale<Base, Exponent>::base;
|
||||
BOOST_CONSTEXPR_OR_CONST long scale<Base, Exponent>::base;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
template<long Base>
|
||||
struct scale<Base, static_rational<0> >
|
||||
{
|
||||
static const long base = Base;
|
||||
BOOST_STATIC_CONSTEXPR long base = Base;
|
||||
typedef static_rational<0> exponent;
|
||||
typedef one value_type;
|
||||
static one value() { one result; return(result); }
|
||||
static BOOST_CONSTEXPR one value() { return(one()); }
|
||||
static std::string name() { return(""); }
|
||||
static std::string symbol() { return(""); }
|
||||
};
|
||||
|
||||
template<long Base>
|
||||
const long scale<Base, static_rational<0> >::base;
|
||||
BOOST_CONSTEXPR_OR_CONST long scale<Base, static_rational<0> >::base;
|
||||
|
||||
template<long Base,class Exponent>
|
||||
std::string symbol_string(const scale<Base,Exponent>&)
|
||||
@@ -83,10 +83,10 @@ std::string name_string(const scale<Base,Exponent>&)
|
||||
template<> \
|
||||
struct scale<base_, exponent_ > \
|
||||
{ \
|
||||
static const long base = base_; \
|
||||
BOOST_STATIC_CONSTEXPR long base = base_; \
|
||||
typedef exponent_ exponent; \
|
||||
typedef double value_type; \
|
||||
static value_type value() { return(val_); } \
|
||||
static BOOST_CONSTEXPR value_type value() { return(val_); } \
|
||||
static std::string name() { return(#name_); } \
|
||||
static std::string symbol() { return(#symbol_); } \
|
||||
}
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
|
||||
#include <boost/units/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_CXX11_CONSTEXPR) || defined(BOOST_UNITS_DOXYGEN)
|
||||
/// A convenience macro that allows definition of static
|
||||
/// constants in headers in an ODR-safe way.
|
||||
#define BOOST_UNITS_STATIC_CONSTANT(name, type) \
|
||||
# define BOOST_UNITS_STATIC_CONSTANT(name, type) \
|
||||
template<bool b> \
|
||||
struct name##_instance_t \
|
||||
{ \
|
||||
@@ -29,6 +30,10 @@ namespace \
|
||||
\
|
||||
template<bool b> \
|
||||
const type name##_instance_t<b>::instance
|
||||
#else
|
||||
# define BOOST_UNITS_STATIC_CONSTANT(name, type) \
|
||||
BOOST_STATIC_CONSTEXPR type name
|
||||
#endif
|
||||
|
||||
/// A convenience macro for static constants with auto
|
||||
/// type deduction.
|
||||
|
||||
@@ -114,11 +114,11 @@ class static_rational
|
||||
(::boost::mpl::divides<D_type, den_type>::value)
|
||||
> type;
|
||||
|
||||
static integer_type numerator() { return Numerator; }
|
||||
static integer_type denominator() { return Denominator; }
|
||||
static BOOST_CONSTEXPR integer_type numerator() { return Numerator; }
|
||||
static BOOST_CONSTEXPR integer_type denominator() { return Denominator; }
|
||||
|
||||
// INTERNAL ONLY
|
||||
static_rational() { }
|
||||
BOOST_CONSTEXPR static_rational() { }
|
||||
//~static_rational() { }
|
||||
};
|
||||
#else
|
||||
@@ -127,19 +127,19 @@ class static_rational
|
||||
{
|
||||
private:
|
||||
|
||||
static const integer_type nabs = static_abs<N>::value,
|
||||
dabs = static_abs<D>::value;
|
||||
BOOST_STATIC_CONSTEXPR integer_type nabs = static_abs<N>::value,
|
||||
dabs = static_abs<D>::value;
|
||||
|
||||
/// greatest common divisor of N and D
|
||||
// need cast to signed because static_gcd returns unsigned long
|
||||
static const integer_type den =
|
||||
BOOST_STATIC_CONSTEXPR integer_type den =
|
||||
static_cast<integer_type>(boost::integer::static_gcd<nabs,dabs>::value) * ((D < 0) ? -1 : 1);
|
||||
|
||||
public:
|
||||
// for mpl arithmetic support
|
||||
typedef detail::static_rational_tag tag;
|
||||
|
||||
static const integer_type Numerator = N/den,
|
||||
BOOST_STATIC_CONSTEXPR integer_type Numerator = N/den,
|
||||
Denominator = D/den;
|
||||
|
||||
/// INTERNAL ONLY
|
||||
@@ -148,11 +148,11 @@ class static_rational
|
||||
/// static_rational<N,D> reduced by GCD
|
||||
typedef static_rational<Numerator,Denominator> type;
|
||||
|
||||
static integer_type numerator() { return Numerator; }
|
||||
static integer_type denominator() { return Denominator; }
|
||||
static BOOST_CONSTEXPR integer_type numerator() { return Numerator; }
|
||||
static BOOST_CONSTEXPR integer_type denominator() { return Denominator; }
|
||||
|
||||
// INTERNAL ONLY
|
||||
static_rational() { }
|
||||
BOOST_CONSTEXPR static_rational() { }
|
||||
//~static_rational() { }
|
||||
};
|
||||
#endif
|
||||
@@ -178,7 +178,7 @@ template<integer_type N> class static_rational<N,0>;
|
||||
|
||||
/// get decimal value of @c static_rational
|
||||
template<class T,integer_type N,integer_type D>
|
||||
inline typename divide_typeof_helper<T,T>::type
|
||||
inline BOOST_CONSTEXPR typename divide_typeof_helper<T,T>::type
|
||||
value(const static_rational<N,D>&)
|
||||
{
|
||||
return T(N)/T(D);
|
||||
|
||||
@@ -31,22 +31,22 @@ template<class Base>
|
||||
struct constant
|
||||
{
|
||||
typedef typename Base::value_type value_type;
|
||||
operator value_type() const { return Base().value(); }
|
||||
value_type value() const { return Base().value(); }
|
||||
value_type uncertainty() const { return Base().uncertainty(); }
|
||||
value_type lower_bound() const { return Base().lower_bound(); }
|
||||
value_type upper_bound() const { return Base().upper_bound(); }
|
||||
BOOST_CONSTEXPR operator value_type() const { return Base().value(); }
|
||||
BOOST_CONSTEXPR value_type value() const { return Base().value(); }
|
||||
BOOST_CONSTEXPR value_type uncertainty() const { return Base().uncertainty(); }
|
||||
BOOST_CONSTEXPR value_type lower_bound() const { return Base().lower_bound(); }
|
||||
BOOST_CONSTEXPR value_type upper_bound() const { return Base().upper_bound(); }
|
||||
};
|
||||
|
||||
template<class Base>
|
||||
struct physical_constant
|
||||
{
|
||||
typedef typename Base::value_type value_type;
|
||||
operator value_type() const { return Base().value(); }
|
||||
value_type value() const { return Base().value(); }
|
||||
value_type uncertainty() const { return Base().uncertainty(); }
|
||||
value_type lower_bound() const { return Base().lower_bound(); }
|
||||
value_type upper_bound() const { return Base().upper_bound(); }
|
||||
BOOST_CONSTEXPR operator value_type() const { return Base().value(); }
|
||||
BOOST_CONSTEXPR value_type value() const { return Base().value(); }
|
||||
BOOST_CONSTEXPR value_type uncertainty() const { return Base().uncertainty(); }
|
||||
BOOST_CONSTEXPR value_type lower_bound() const { return Base().lower_bound(); }
|
||||
BOOST_CONSTEXPR value_type upper_bound() const { return Base().upper_bound(); }
|
||||
};
|
||||
|
||||
#define BOOST_UNITS_DEFINE_HELPER(name, symbol, template_name) \
|
||||
@@ -64,6 +64,7 @@ struct name ## _typeof_helper<template_name<Arg1, Arg2>, constant<T> >\
|
||||
}; \
|
||||
\
|
||||
template<class T, class Arg1, class Arg2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<typename T::value_type, template_name<Arg1, Arg2> >::type \
|
||||
operator symbol(const constant<T>& t, const template_name<Arg1, Arg2>& u)\
|
||||
{ \
|
||||
@@ -71,6 +72,7 @@ operator symbol(const constant<T>& t, const template_name<Arg1, Arg2>& u)\
|
||||
} \
|
||||
\
|
||||
template<class T, class Arg1, class Arg2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<template_name<Arg1, Arg2>, typename T::value_type>::type \
|
||||
operator symbol(const template_name<Arg1, Arg2>& u, const constant<T>& t)\
|
||||
{ \
|
||||
@@ -97,6 +99,7 @@ struct name ## _typeof_helper<constant<T1>, constant<T2> > \
|
||||
}; \
|
||||
\
|
||||
template<class T1, class T2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<typename T1::value_type, typename T2::value_type>::type \
|
||||
operator symbol(const constant<T1>& t, const constant<T2>& u) \
|
||||
{ \
|
||||
@@ -116,6 +119,7 @@ struct name ## _typeof_helper<T1, constant<T2> > \
|
||||
}; \
|
||||
\
|
||||
template<class T1, class T2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<typename T1::value_type, T2>::type \
|
||||
operator symbol(const constant<T1>& t, const T2& u) \
|
||||
{ \
|
||||
@@ -123,6 +127,7 @@ operator symbol(const constant<T1>& t, const T2& u) \
|
||||
} \
|
||||
\
|
||||
template<class T1, class T2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<T1, typename T2::value_type>::type \
|
||||
operator symbol(const T1& t, const constant<T2>& u) \
|
||||
{ \
|
||||
@@ -151,6 +156,7 @@ struct name ## _typeof_helper<one, constant<T2> > \
|
||||
}; \
|
||||
\
|
||||
template<class T1> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<typename T1::value_type, one>::type \
|
||||
operator symbol(const constant<T1>& t, const one& u) \
|
||||
{ \
|
||||
@@ -158,6 +164,7 @@ operator symbol(const constant<T1>& t, const one& u) \
|
||||
} \
|
||||
\
|
||||
template<class T2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<one, typename T2::value_type>::type \
|
||||
operator symbol(const one& t, const constant<T2>& u) \
|
||||
{ \
|
||||
@@ -174,7 +181,7 @@ struct power_typeof_helper<constant<T1>, static_rational<N,D> >
|
||||
{
|
||||
typedef power_typeof_helper<typename T1::value_type, static_rational<N,D> > base;
|
||||
typedef typename base::type type;
|
||||
static type value(const constant<T1>& arg)
|
||||
static BOOST_CONSTEXPR type value(const constant<T1>& arg)
|
||||
{
|
||||
return base::value(arg.value());
|
||||
}
|
||||
@@ -189,6 +196,7 @@ struct name ## _typeof_helper<constant<T1> > \
|
||||
}; \
|
||||
\
|
||||
template<class T1> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<typename T1::value_type, one>::type \
|
||||
operator symbol(const constant<T1>& t, const one& u) \
|
||||
{ \
|
||||
@@ -196,21 +204,22 @@ operator symbol(const constant<T1>& t, const one& u) \
|
||||
} \
|
||||
\
|
||||
template<class T2> \
|
||||
BOOST_CONSTEXPR \
|
||||
typename name ## _typeof_helper<one, typename T2::value_type>::type \
|
||||
operator symbol(const one& t, const constant<T2>& u) \
|
||||
{ \
|
||||
return(t symbol u.value()); \
|
||||
}
|
||||
|
||||
#define BOOST_UNITS_PHYSICAL_CONSTANT(name, type, value_, uncertainty_) \
|
||||
struct name ## _t { \
|
||||
typedef type value_type; \
|
||||
operator value_type() const { return value_; } \
|
||||
value_type value() const { return value_; } \
|
||||
value_type uncertainty() const { return uncertainty_; } \
|
||||
value_type lower_bound() const { return value_-uncertainty_; } \
|
||||
value_type upper_bound() const { return value_+uncertainty_; } \
|
||||
}; \
|
||||
#define BOOST_UNITS_PHYSICAL_CONSTANT(name, type, value_, uncertainty_) \
|
||||
struct name ## _t { \
|
||||
typedef type value_type; \
|
||||
BOOST_CONSTEXPR operator value_type() const { return value_; } \
|
||||
BOOST_CONSTEXPR value_type value() const { return value_; } \
|
||||
BOOST_CONSTEXPR value_type uncertainty() const { return uncertainty_; } \
|
||||
BOOST_CONSTEXPR value_type lower_bound() const { return value_-uncertainty_; } \
|
||||
BOOST_CONSTEXPR value_type upper_bound() const { return value_+uncertainty_; } \
|
||||
}; \
|
||||
BOOST_UNITS_STATIC_CONSTANT(name, boost::units::constant<boost::units::physical_constant<name ## _t> >) = { }
|
||||
|
||||
// stream output
|
||||
|
||||
@@ -42,11 +42,11 @@ class unit
|
||||
typedef Dim dimension_type;
|
||||
typedef System system_type;
|
||||
|
||||
unit() { }
|
||||
unit(const this_type&) { }
|
||||
BOOST_CONSTEXPR unit() { }
|
||||
BOOST_CONSTEXPR unit(const this_type&) { }
|
||||
//~unit() { }
|
||||
|
||||
this_type& operator=(const this_type&) { return *this; }
|
||||
BOOST_CXX14_CONSTEXPR this_type& operator=(const this_type&) { return *this; }
|
||||
|
||||
// sun will ignore errors resulting from templates
|
||||
// instantiated in the return type of a function.
|
||||
@@ -305,7 +305,7 @@ struct power_typeof_helper<unit<Dim,System>,static_rational<N,D> >
|
||||
{
|
||||
typedef unit<typename static_power<Dim,static_rational<N,D> >::type,typename static_power<System, static_rational<N,D> >::type> type;
|
||||
|
||||
static type value(const unit<Dim,System>&)
|
||||
static BOOST_CONSTEXPR type value(const unit<Dim,System>&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
@@ -317,7 +317,7 @@ struct root_typeof_helper<unit<Dim,System>,static_rational<N,D> >
|
||||
{
|
||||
typedef unit<typename static_root<Dim,static_rational<N,D> >::type,typename static_root<System, static_rational<N,D> >::type> type;
|
||||
|
||||
static type value(const unit<Dim,System>&)
|
||||
static BOOST_CONSTEXPR type value(const unit<Dim,System>&)
|
||||
{
|
||||
return type();
|
||||
}
|
||||
@@ -325,6 +325,7 @@ struct root_typeof_helper<unit<Dim,System>,static_rational<N,D> >
|
||||
|
||||
/// unit runtime unary plus
|
||||
template<class Dim,class System>
|
||||
BOOST_CONSTEXPR
|
||||
typename unary_plus_typeof_helper< unit<Dim,System> >::type
|
||||
operator+(const unit<Dim,System>&)
|
||||
{
|
||||
@@ -335,6 +336,7 @@ operator+(const unit<Dim,System>&)
|
||||
|
||||
/// unit runtime unary minus
|
||||
template<class Dim,class System>
|
||||
BOOST_CONSTEXPR
|
||||
typename unary_minus_typeof_helper< unit<Dim,System> >::type
|
||||
operator-(const unit<Dim,System>&)
|
||||
{
|
||||
@@ -348,6 +350,7 @@ template<class Dim1,
|
||||
class Dim2,
|
||||
class System1,
|
||||
class System2>
|
||||
BOOST_CONSTEXPR
|
||||
typename add_typeof_helper< unit<Dim1,System1>,
|
||||
unit<Dim2,System2> >::type
|
||||
operator+(const unit<Dim1,System1>&,const unit<Dim2,System2>&)
|
||||
@@ -366,6 +369,7 @@ template<class Dim1,
|
||||
class Dim2,
|
||||
class System1,
|
||||
class System2>
|
||||
BOOST_CONSTEXPR
|
||||
typename subtract_typeof_helper< unit<Dim1,System1>,
|
||||
unit<Dim2,System2> >::type
|
||||
operator-(const unit<Dim1,System1>&,const unit<Dim2,System2>&)
|
||||
@@ -384,6 +388,7 @@ template<class Dim1,
|
||||
class Dim2,
|
||||
class System1,
|
||||
class System2>
|
||||
BOOST_CONSTEXPR
|
||||
typename multiply_typeof_helper< unit<Dim1,System1>,
|
||||
unit<Dim2,System2> >::type
|
||||
operator*(const unit<Dim1,System1>&,const unit<Dim2,System2>&)
|
||||
@@ -399,6 +404,7 @@ template<class Dim1,
|
||||
class Dim2,
|
||||
class System1,
|
||||
class System2>
|
||||
BOOST_CONSTEXPR
|
||||
typename divide_typeof_helper< unit<Dim1,System1>,
|
||||
unit<Dim2,System2> >::type
|
||||
operator/(const unit<Dim1,System1>&,const unit<Dim2,System2>&)
|
||||
@@ -415,6 +421,7 @@ template<class Dim1,
|
||||
class System1,
|
||||
class System2>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator==(const unit<Dim1,System1>&,const unit<Dim2,System2>&)
|
||||
{
|
||||
@@ -427,6 +434,7 @@ template<class Dim1,
|
||||
class System1,
|
||||
class System2>
|
||||
inline
|
||||
BOOST_CONSTEXPR
|
||||
bool
|
||||
operator!=(const unit<Dim1,System1>&,const unit<Dim2,System2>&)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user