/usr/include/boost/units
NameSizeModeActions
base_units/-0755rm
detail/-0755rm
physical_dimensions/-0755rm
systems/-0755rm
absolute.hpp55400644editdlrm
base_dimension.hpp36920644editdlrm
base_unit.hpp41320644editdlrm
cmath.hpp205920644editdlrm
config.hpp28290644editdlrm
conversion.hpp95180644editdlrm
derived_dimension.hpp64650644editdlrm
dim.hpp47450644editdlrm
dimension.hpp44030644editdlrm
dimensionless_quantity.hpp9950644editdlrm
dimensionless_type.hpp13150644editdlrm
dimensionless_unit.hpp9570644editdlrm
get_dimension.hpp12210644editdlrm
get_system.hpp11650644editdlrm
heterogeneous_system.hpp122580644editdlrm
homogeneous_system.hpp23990644editdlrm
io.hpp324700644editdlrm
is_dim.hpp8850644editdlrm
is_dimensionless.hpp11070644editdlrm
is_dimensionless_quantity.hpp9360644editdlrm
is_dimensionless_unit.hpp9050644editdlrm
is_dimension_list.hpp10570644editdlrm
is_quantity.hpp9160644editdlrm
is_quantity_of_dimension.hpp11150644editdlrm
is_quantity_of_system.hpp10970644editdlrm
is_unit.hpp8790644editdlrm
is_unit_of_dimension.hpp11380644editdlrm
is_unit_of_system.hpp11270644editdlrm
lambda.hpp268410644editdlrm
limits.hpp43450644editdlrm
make_scaled_unit.hpp18170644editdlrm
make_system.hpp49140644editdlrm
operators.hpp62870644editdlrm
physical_dimensions.hpp45320644editdlrm
pow.hpp30330644editdlrm
quantity.hpp418600644editdlrm
reduce_unit.hpp8680644editdlrm
scale.hpp50620644editdlrm
scaled_base_unit.hpp36430644editdlrm
static_constant.hpp24250644editdlrm
static_rational.hpp104350644editdlrm
unit.hpp134490644editdlrm
units_fwd.hpp21910644editdlrm
Edit: /usr/include/boost/units/absolute.hpp (5540B)
// Boost.Units - A C++ library for zero-overhead dimensional analysis and // unit/quantity manipulation and conversion // // Copyright (C) 2003-2008 Matthias Christian Schabel // Copyright (C) 2008 Steven Watanabe // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) /// /// \file /// \brief Absolute units (points rather than vectors). /// \details Operations between absolute units, and relative units like temperature differences. /// #ifndef BOOST_UNITS_ABSOLUTE_HPP #define BOOST_UNITS_ABSOLUTE_HPP #include #include namespace boost { namespace units { /// A wrapper to represent absolute units (points rather than vectors). Intended /// originally for temperatures, this class implements operators for absolute units /// so that addition of a relative unit to an absolute unit results in another /// absolute unit : absolute +/- T -> absolute and subtraction of one absolute /// unit from another results in a relative unit : absolute - absolute -> T. template class absolute { public: typedef absolute this_type; typedef Y value_type; BOOST_CONSTEXPR absolute() : val_() { } BOOST_CONSTEXPR absolute(const value_type& val) : val_(val) { } BOOST_CONSTEXPR absolute(const this_type& source) : val_(source.val_) { } BOOST_CXX14_CONSTEXPR this_type& operator=(const this_type& source) { val_ = source.val_; return *this; } BOOST_CONSTEXPR const value_type& value() const { return val_; } 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_; }; /// add a relative value to an absolute one template BOOST_CONSTEXPR absolute operator+(const absolute& aval,const Y& rval) { return absolute(aval.value()+rval); } /// add a relative value to an absolute one template BOOST_CONSTEXPR absolute operator+(const Y& rval,const absolute& aval) { return absolute(aval.value()+rval); } /// subtract a relative value from an absolute one template BOOST_CONSTEXPR absolute operator-(const absolute& aval,const Y& rval) { return absolute(aval.value()-rval); } /// subtracting two absolutes gives a difference template BOOST_CONSTEXPR Y operator-(const absolute& aval1,const absolute& aval2) { return Y(aval1.value()-aval2.value()); } /// creates a quantity from an absolute unit and a raw value template BOOST_CONSTEXPR quantity >, T> operator*(const T& t, const absolute >&) { return(quantity >, T>::from_value(t)); } /// creates a quantity from an absolute unit and a raw value template BOOST_CONSTEXPR quantity >, T> operator*(const absolute >&, const T& t) { return(quantity >, T>::from_value(t)); } /// Print an absolute unit template std::basic_ostream& operator<<(std::basic_ostream& os,const absolute& aval) { os << "absolute " << aval.value(); return os; } } // namespace units } // namespace boost #if BOOST_UNITS_HAS_BOOST_TYPEOF #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::absolute, (class)) #endif namespace boost { namespace units { /// Macro to define the offset between two absolute units. /// Requires the value to be in the destination units e.g /// @code /// BOOST_UNITS_DEFINE_CONVERSION_OFFSET(celsius_base_unit, fahrenheit_base_unit, double, 32.0); /// @endcode /// @c BOOST_UNITS_DEFINE_CONVERSION_FACTOR is also necessary to /// specify the conversion factor. Like @c BOOST_UNITS_DEFINE_CONVERSION_FACTOR /// this macro defines both forward and reverse conversions so /// defining, e.g., the conversion from celsius to fahrenheit as above will also /// define the inverse conversion from fahrenheit to celsius. #define BOOST_UNITS_DEFINE_CONVERSION_OFFSET(From, To, type_, value_) \ namespace boost { \ namespace units { \ template<> \ struct affine_conversion_helper< \ reduce_unit::type, \ reduce_unit::type> \ { \ BOOST_STATIC_CONSTEXPR bool is_defined = true; \ typedef type_ type; \ static BOOST_CONSTEXPR type value() { return(value_); } \ }; \ } \ } \ void boost_units_require_semicolon() } // namespace units } // namespace boost #endif // BOOST_UNITS_ABSOLUTE_HPP