/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/unit.hpp (13449B)
// 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) #ifndef BOOST_UNITS_UNIT_HPP #define BOOST_UNITS_UNIT_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace units { /// class representing a model-dependent unit with no associated value /// (e.g. meters, Kelvin, feet, etc...) template class unit { public: typedef unit unit_type; typedef unit this_type; typedef Dim dimension_type; typedef System system_type; BOOST_CONSTEXPR unit() { } BOOST_CONSTEXPR unit(const this_type&) { } //~unit() { } 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. // Make sure that we get an error anyway by putting. // the check in the destructor. #ifdef __SUNPRO_CC ~unit() { BOOST_MPL_ASSERT((detail::check_system)); BOOST_MPL_ASSERT((is_dimension_list)); } #else private: BOOST_MPL_ASSERT((detail::check_system)); BOOST_MPL_ASSERT((is_dimension_list)); #endif }; } } #if BOOST_UNITS_HAS_BOOST_TYPEOF #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::unit, 2) #endif namespace boost { namespace units { /// Returns a unique type for every unit. template struct reduce_unit > { typedef unit< Dim, typename detail::make_heterogeneous_system< Dim, System >::type > type; }; /// INTERNAL ONLY template struct is_implicitly_convertible : boost::is_same::type, typename reduce_unit::type> { }; /// unit unary plus typeof helper /// INTERNAL ONLY template struct unary_plus_typeof_helper< unit > { typedef unit type; }; /// unit unary minus typeof helper /// INTERNAL ONLY template struct unary_minus_typeof_helper< unit > { typedef unit type; }; /// unit add typeof helper /// INTERNAL ONLY template struct add_typeof_helper< unit,unit > { typedef unit type; }; /// unit subtract typeof helper /// INTERNAL ONLY template struct subtract_typeof_helper< unit,unit > { typedef unit type; }; /// unit multiply typeof helper for two identical homogeneous systems /// INTERNAL ONLY template struct multiply_typeof_helper< unit >, unit > > { typedef unit::type,homogeneous_system > type; }; /// unit multiply typeof helper for two different homogeneous systems /// INTERNAL ONLY template struct multiply_typeof_helper< unit >, unit > > { typedef unit< typename mpl::times::type, typename detail::multiply_systems< typename detail::make_heterogeneous_system::type, typename detail::make_heterogeneous_system::type >::type > type; }; /// unit multiply typeof helper for a heterogeneous and a homogeneous system /// INTERNAL ONLY template struct multiply_typeof_helper< unit >, unit > > { typedef unit< typename mpl::times::type, typename detail::multiply_systems< heterogeneous_system, typename detail::make_heterogeneous_system::type >::type > type; }; /// unit multiply typeof helper for a homogeneous and a heterogeneous system /// INTERNAL ONLY template struct multiply_typeof_helper< unit >, unit > > { typedef unit< typename mpl::times::type, typename detail::multiply_systems< typename detail::make_heterogeneous_system::type, heterogeneous_system >::type > type; }; /// unit multiply typeof helper for two heterogeneous systems /// INTERNAL ONLY template struct multiply_typeof_helper< unit >, unit > > { typedef unit< typename mpl::times::type, typename detail::multiply_systems< heterogeneous_system, heterogeneous_system >::type > type; }; /// unit divide typeof helper for two identical homogeneous systems /// INTERNAL ONLY template struct divide_typeof_helper< unit >, unit > > { typedef unit::type,homogeneous_system > type; }; /// unit divide typeof helper for two different homogeneous systems /// INTERNAL ONLY template struct divide_typeof_helper< unit >, unit > > { typedef unit< typename mpl::divides::type, typename detail::divide_systems< typename detail::make_heterogeneous_system::type, typename detail::make_heterogeneous_system::type >::type > type; }; /// unit divide typeof helper for a heterogeneous and a homogeneous system /// INTERNAL ONLY template struct divide_typeof_helper< unit >, unit > > { typedef unit< typename mpl::divides::type, typename detail::divide_systems< heterogeneous_system, typename detail::make_heterogeneous_system::type >::type > type; }; /// unit divide typeof helper for a homogeneous and a heterogeneous system /// INTERNAL ONLY template struct divide_typeof_helper< unit >, unit > > { typedef unit< typename mpl::divides::type, typename detail::divide_systems< typename detail::make_heterogeneous_system::type, heterogeneous_system >::type > type; }; /// unit divide typeof helper for two heterogeneous systems /// INTERNAL ONLY template struct divide_typeof_helper< unit >, unit > > { typedef unit< typename mpl::divides::type, typename detail::divide_systems< heterogeneous_system, heterogeneous_system >::type > type; }; /// raise unit to a @c static_rational power template struct power_typeof_helper,static_rational > { typedef unit >::type,typename static_power >::type> type; static BOOST_CONSTEXPR type value(const unit&) { return type(); } }; /// take the @c static_rational root of a unit template struct root_typeof_helper,static_rational > { typedef unit >::type,typename static_root >::type> type; static BOOST_CONSTEXPR type value(const unit&) { return type(); } }; /// unit runtime unary plus template BOOST_CONSTEXPR typename unary_plus_typeof_helper< unit >::type operator+(const unit&) { typedef typename unary_plus_typeof_helper< unit >::type type; return type(); } /// unit runtime unary minus template BOOST_CONSTEXPR typename unary_minus_typeof_helper< unit >::type operator-(const unit&) { typedef typename unary_minus_typeof_helper< unit >::type type; return type(); } /// runtime add two units template BOOST_CONSTEXPR typename add_typeof_helper< unit, unit >::type operator+(const unit&,const unit&) { BOOST_STATIC_ASSERT((boost::is_same::value == true)); typedef System1 system_type; typedef typename add_typeof_helper< unit, unit >::type type; return type(); } /// runtime subtract two units template BOOST_CONSTEXPR typename subtract_typeof_helper< unit, unit >::type operator-(const unit&,const unit&) { BOOST_STATIC_ASSERT((boost::is_same::value == true)); typedef System1 system_type; typedef typename subtract_typeof_helper< unit, unit >::type type; return type(); } /// runtime multiply two units template BOOST_CONSTEXPR typename multiply_typeof_helper< unit, unit >::type operator*(const unit&,const unit&) { typedef typename multiply_typeof_helper< unit, unit >::type type; return type(); } /// runtime divide two units template BOOST_CONSTEXPR typename divide_typeof_helper< unit, unit >::type operator/(const unit&,const unit&) { typedef typename divide_typeof_helper< unit, unit >::type type; return type(); } /// unit runtime @c operator== template inline BOOST_CONSTEXPR bool operator==(const unit&,const unit&) { return boost::is_same >::type, typename reduce_unit >::type>::value; } /// unit runtime @c operator!= template inline BOOST_CONSTEXPR bool operator!=(const unit&,const unit&) { return !boost::is_same >::type, typename reduce_unit >::type>::value; } } // namespace units } // namespace boost #endif // BOOST_UNITS_UNIT_HPP