/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/heterogeneous_system.hpp (12258B)
// 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) 2007-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_HETEROGENEOUS_SYSTEM_HPP #define BOOST_UNITS_HETEROGENEOUS_SYSTEM_HPP /// \file /// \brief A heterogeneous system is a sorted list of base unit/exponent pairs. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace boost { namespace units { namespace detail { // A normal system is a sorted list of base units. // A heterogeneous system is a sorted list of base unit/exponent pairs. // As long as we don't need to convert heterogeneous systems // directly everything is cool. template struct is_zero : mpl::false_ {}; template<> struct is_zero > : mpl::true_ {}; } // namespace detail /// INTERNAL ONLY template struct heterogeneous_system_impl { typedef L type; typedef Dimensions dimensions; typedef Scale scale; }; /// INTERNAL ONLY typedef dimensionless_type no_scale; /// A system that can represent any possible combination /// of units at the expense of not preserving information /// about how it was created. Do not create specializations /// of this template directly. Instead use @c reduce_unit and /// @c base_unit<...>::unit_type. template struct heterogeneous_system : T {}; /// INTERNAL ONLY struct heterogeneous_system_dim_tag {}; /// INTERNAL ONLY template struct heterogeneous_system_dim { typedef heterogeneous_system_dim_tag tag; typedef heterogeneous_system_dim type; typedef Unit tag_type; typedef Exponent value_type; }; /// INTERNAL ONLY #define BOOST_UNITS_MAKE_HETEROGENEOUS_UNIT(BaseUnit, Dimensions) \ boost::units::unit< \ Dimensions, \ boost::units::heterogeneous_system< \ boost::units::heterogeneous_system_impl< \ boost::units::list< \ boost::units::heterogeneous_system_dim< \ BaseUnit, \ boost::units::static_rational<1> \ >, \ boost::units::dimensionless_type \ >, \ Dimensions, \ boost::units::no_scale \ > \ > \ > } // namespace units } // namespace boost #if BOOST_UNITS_HAS_BOOST_TYPEOF #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP() BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_impl, (class)(class)(class)) BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system, (class)) BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::heterogeneous_system_dim, (class)(class)) #endif namespace boost { namespace mpl { /// INTERNAL ONLY template<> struct less_impl { template struct apply : mpl::less {}; }; } namespace units { namespace detail { template struct is_empty_dim > : detail::is_zero {}; } // namespace detail } // namespace units namespace mpl { /// INTERNAL ONLY template<> struct plus_impl { template struct apply { typedef boost::units::heterogeneous_system_dim< typename T0::tag_type, typename mpl::plus::type > type; }; }; /// INTERNAL ONLY template<> struct times_impl { template struct apply { typedef boost::units::heterogeneous_system_dim< typename T0::tag_type, typename mpl::times::type > type; }; }; /// INTERNAL ONLY template<> struct divides_impl { template struct apply { typedef boost::units::heterogeneous_system_dim< typename T0::tag_type, typename mpl::divides::type > type; }; }; /// INTERNAL ONLY template<> struct negate_impl { template struct apply { typedef boost::units::heterogeneous_system_dim::type> type; }; }; } // namespace mpl namespace units { namespace detail { template struct make_heterogeneous_system_impl { template struct apply { typedef typename push_front_if::value)>::template apply< typename make_heterogeneous_system_impl::template apply< typename UnitsBegin::next, typename ExponentsBegin::next >::type, heterogeneous_system_dim >::type type; }; }; template<> struct make_heterogeneous_system_impl<0> { template struct apply { typedef dimensionless_type type; }; }; template struct make_heterogeneous_system { typedef typename calculate_base_unit_exponents::type exponents; BOOST_MPL_ASSERT_MSG((!boost::is_same::value), the_specified_dimension_is_not_representible_in_the_given_system, (types)); typedef typename make_heterogeneous_system_impl::template apply< typename System::type, exponents >::type unit_list; typedef heterogeneous_system > type; }; template struct make_heterogeneous_system > { typedef heterogeneous_system type; }; template struct multiply_systems { typedef heterogeneous_system< heterogeneous_system_impl< typename mpl::times::type, typename mpl::times::type, typename mpl::times::type > > type; }; template struct divide_systems { typedef heterogeneous_system< heterogeneous_system_impl< typename mpl::divides::type, typename mpl::divides::type, typename mpl::divides::type > > type; }; } // namespace detail /// INTERNAL ONLY template struct static_power, static_rational > { typedef heterogeneous_system< heterogeneous_system_impl< typename static_power >::type, typename static_power >::type, typename static_power >::type > > type; }; /// INTERNAL ONLY template struct static_root, static_rational > { typedef heterogeneous_system< heterogeneous_system_impl< typename static_root >::type, typename static_root >::type, typename static_root >::type > > type; }; namespace detail { template struct unscale_heterogeneous_system_impl { template struct apply { typedef typename push_front_or_add< typename unscale_heterogeneous_system_impl::template apply< typename Begin::next >::type, typename unscale::type >::type type; }; }; template<> struct unscale_heterogeneous_system_impl<0> { template struct apply { typedef dimensionless_type type; }; }; } // namespace detail /// Unscale all the base units. e.g /// km s -> m s /// cm km -> m^2 /// INTERNAL ONLY template struct unscale > { typedef heterogeneous_system< heterogeneous_system_impl< typename detail::unscale_heterogeneous_system_impl< T::type::size::value >::template apply< typename T::type >::type, typename T::dimensions, no_scale > > type; }; /// INTERNAL ONLY template struct unscale > { typedef heterogeneous_system_dim::type, Exponent> type; }; namespace detail { template struct get_scale_list_of_heterogeneous_system_impl { template struct apply { typedef typename mpl::times< typename get_scale_list_of_heterogeneous_system_impl::template apply< typename Begin::next >::type, typename get_scale_list::type >::type type; }; }; template<> struct get_scale_list_of_heterogeneous_system_impl<0> { template struct apply { typedef dimensionless_type type; }; }; } // namespace detail /// INTERNAL ONLY template struct get_scale_list > { typedef typename mpl::times< typename detail::get_scale_list_of_heterogeneous_system_impl< T::type::size::value >::template apply::type, typename T::scale >::type type; }; /// INTERNAL ONLY template struct get_scale_list > { typedef typename static_power::type, Exponent>::type type; }; namespace detail { template struct check_system : mpl::false_ {}; template struct check_system >, Dimension> : mpl::true_ {}; } // namespace detail } // namespace units } // namespace boost #endif