![]() |
Home | Libraries | People | FAQ | More |
Absolute units (points rather than vectors).
Operations between absolute units, and relative units like temperature differences.
BOOST_UNITS_DEFINE_CONVERSION_OFFSET(From, To, type_, value_)
namespace boost { namespace units { template<typename Y> class absolute; // add a relative value to an absolute one template<typename Y> absolute< Y > operator+(const absolute< Y > & aval, const Y & rval); // add a relative value to an absolute one template<typename Y> absolute< Y > operator+(const Y & rval, const absolute< Y > & aval); // subtract a relative value from an absolute one template<typename Y> absolute< Y > operator-(const absolute< Y > & aval, const Y & rval); // subtracting two absolutes gives a difference template<typename Y> Y operator-(const absolute< Y > & aval1, const absolute< Y > & aval2); // creates a quantity from an absolute unit and a raw value template<typename D, typename S, typename T> quantity< absolute< unit< D, S > >, T > operator*(const T & t, const absolute< unit< D, S > > &); // creates a quantity from an absolute unit and a raw value template<typename D, typename S, typename T> quantity< absolute< unit< D, S > >, T > operator*(const absolute< unit< D, S > > &, const T & t); // Print an absolute unit. template<typename Char, typename Traits, typename Y> std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > & os, const absolute< Y > & aval); } }
base dimensions (mass, length, time...).
base dimension definition registration.
namespace boost { namespace units { template<typename Derived, long N> class base_dimension; } }
base unit (meter, kg, sec...).
base unit definition registration.
namespace boost { namespace units { template<typename Derived, typename Dim, long N> class base_unit; } }
Overloads of functions in <cmath> for quantities.
Only functions for which a dimensionally-correct result type can be determined are overloaded. All functions work with dimensionless quantities.
namespace boost { namespace units { template<typename Unit, typename Y> bool isfinite(const quantity< Unit, Y > & q); template<typename Unit, typename Y> bool isinf(const quantity< Unit, Y > & q); template<typename Unit, typename Y> bool isnan(const quantity< Unit, Y > & q); template<typename Unit, typename Y> bool isnormal(const quantity< Unit, Y > & q); template<typename Unit, typename Y> bool isgreater(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> bool isgreaterequal(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> bool isless(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> bool islessequal(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> bool islessgreater(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> bool isunordered(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > abs(const quantity< Unit, Y > & q); template<typename Unit, typename Y> quantity< Unit, Y > ceil(const quantity< Unit, Y > & q); template<typename Unit, typename Y> quantity< Unit, Y > copysign(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > fabs(const quantity< Unit, Y > & q); template<typename Unit, typename Y> quantity< Unit, Y > floor(const quantity< Unit, Y > & q); template<typename Unit, typename Y> quantity< Unit, Y > fdim(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > fmax(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > fmin(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> int fpclassify(const quantity< Unit, Y > & q); template<typename Unit, typename Y> root_typeof_helper< typename add_typeof_helper< typename power_typeof_helper< quantity< Unit, Y >, static_rational< 2 > >::type, typename power_typeof_helper< quantity< Unit, Y >, static_rational< 2 > >::type >::type, static_rational< 2 > >::type hypot(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > nextafter(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > nexttoward(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > round(const quantity< Unit, Y > & q); template<typename Unit, typename Y> int signbit(const quantity< Unit, Y > & q); template<typename Unit, typename Y> quantity< Unit, Y > trunc(const quantity< Unit, Y > & q); template<typename Unit, typename Y> quantity< Unit, Y > fmod(const quantity< Unit, Y > & q1, const quantity< Unit, Y > & q2); template<typename Unit, typename Y> quantity< Unit, Y > modf(const quantity< Unit, Y > & q1, quantity< Unit, Y > * q2); template<typename Unit, typename Y, typename Int> quantity< Unit, Y > frexp(const quantity< Unit, Y > & q, Int * ex); template<typename S, typename Y> quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > pow(const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > &, const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > &); template<typename S, typename Y> quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > exp(const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > & q); template<typename Unit, typename Y, typename Int> quantity< Unit, Y > ldexp(const quantity< Unit, Y > & q, const Int & ex); template<typename S, typename Y> quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > log(const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > & q); template<typename S, typename Y> quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > log10(const quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(S), Y > & q); template<typename Unit, typename Y> root_typeof_helper< quantity< Unit, Y >, static_rational< 2 > >::type sqrt(const quantity< Unit, Y > & q); // cos of theta in radians template<typename Y> dimensionless_quantity< si::system, Y >::type cos(const quantity< si::plane_angle, Y > & theta); // sin of theta in radians template<typename Y> dimensionless_quantity< si::system, Y >::type sin(const quantity< si::plane_angle, Y > & theta); // tan of theta in radians template<typename Y> dimensionless_quantity< si::system, Y >::type tan(const quantity< si::plane_angle, Y > & theta); // cos of theta in other angular units template<typename System, typename Y> dimensionless_quantity< System, Y >::type cos(const quantity< unit< plane_angle_dimension, System >, Y > & theta); // sin of theta in other angular units template<typename System, typename Y> dimensionless_quantity< System, Y >::type sin(const quantity< unit< plane_angle_dimension, System >, Y > & theta); // tan of theta in other angular units template<typename System, typename Y> dimensionless_quantity< System, Y >::type tan(const quantity< unit< plane_angle_dimension, System >, Y > & theta); // acos of dimensionless quantity returning angle in same system template<typename Y, typename System> quantity< unit< plane_angle_dimension, homogeneous_system< System > >, Y > acos(const quantity< unit< dimensionless_type, homogeneous_system< System > >, Y > & val); // acos of dimensionless quantity returning angle in radians template<typename Y> quantity< angle::radian_base_unit::unit_type, Y > acos(const quantity< unit< dimensionless_type, heterogeneous_dimensionless_system >, Y > & val); // asin of dimensionless quantity returning angle in same system template<typename Y, typename System> quantity< unit< plane_angle_dimension, homogeneous_system< System > >, Y > asin(const quantity< unit< dimensionless_type, homogeneous_system< System > >, Y > & val); // asin of dimensionless quantity returning angle in radians template<typename Y> quantity< angle::radian_base_unit::unit_type, Y > asin(const quantity< unit< dimensionless_type, heterogeneous_dimensionless_system >, Y > & val); // atan of dimensionless quantity returning angle in same system template<typename Y, typename System> quantity< unit< plane_angle_dimension, homogeneous_system< System > >, Y > atan(const quantity< unit< dimensionless_type, homogeneous_system< System > >, Y > & val); // atan of dimensionless quantity returning angle in radians template<typename Y> quantity< angle::radian_base_unit::unit_type, Y > atan(const quantity< unit< dimensionless_type, heterogeneous_dimensionless_system >, Y > & val); // atan2 ofvalue_type
returning angle in radians template<typename Y, typename Dimension, typename System> 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); // atan2 ofvalue_type
returning angle in radians template<typename Y, typename Dimension, typename System> 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); } }
BOOST_UNITS_REQUIRE_LAYOUT_COMPATIBILITY BOOST_UNITS_NO_COMPILER_CHECK BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
Template for defining conversions between quantities.
BOOST_UNITS_DEFINE_CONVERSION_FACTOR(Source, Destination, type_, value_) BOOST_UNITS_DEFINE_CONVERSION_FACTOR_TEMPLATE(Params, Source, Destination, type_, value_) BOOST_UNITS_DEFAULT_CONVERSION(Source, Dest) BOOST_UNITS_DEFAULT_CONVERSION_TEMPLATE(Params, Source, Dest)
namespace boost { namespace units { template<typename From, typename To> struct conversion_helper; // Find the conversion factor between two units. template<typename FromUnit, typename ToUnit> unspecified conversion_factor(const FromUnit &, const ToUnit &); } }
namespace boost { namespace units { template<typename DT1 = dimensionless_type, long E1 = 0, typename DT2 = dimensionless_type, long E2 = 0, typename DT3 = dimensionless_type, long E3 = 0, typename DT4 = dimensionless_type, long E4 = 0, typename DT5 = dimensionless_type, long E5 = 0, typename DT6 = dimensionless_type, long E6 = 0, typename DT7 = dimensionless_type, long E7 = 0, typename DT8 = dimensionless_type, long E8 = 0> struct derived_dimension; } }
Handling of fundamental dimension/exponent pairs.
namespace boost { namespace units { template<typename T, typename V> struct dim; } }
Core metaprogramming utilities for compile-time dimensional analysis.
namespace boost { namespace units { template<typename Seq> struct make_dimension_list; template<typename DL, typename Ex> struct static_power; template<typename DL, typename Rt> struct static_root; } }
Utility class to simplify construction of dimensionless quantities.
namespace boost { namespace units { template<typename System, typename Y> struct dimensionless_quantity; } }
Dimension lists in which all exponents resolve to zero reduce to dimensionless_type
.
namespace boost { namespace units { struct dimensionless_type; } }
Utility class to simplify construction of dimensionless units in a system.
namespace boost { namespace units { template<typename System> struct dimensionless_unit; } }
Get the dimension of a unit, absolute unit and quantity.
namespace boost { namespace units { template<typename T> struct get_dimension; template<typename Dim, typename System> struct get_dimension<unit< Dim, System >>; template<typename Unit> struct get_dimension<absolute< Unit >>; template<typename Unit, typename Y> struct get_dimension<quantity< Unit, Y >>; } }
Get the system of a unit, absolute unit or quantity.
namespace boost { namespace units { template<typename T> struct get_system; template<typename Dim, typename System> struct get_system<unit< Dim, System >>; template<typename Unit> struct get_system<absolute< Unit >>; template<typename Unit, typename Y> struct get_system<quantity< Unit, Y >>; } }
A heterogeneous system is a sorted list of base unit/exponent pairs.
namespace boost { namespace mpl { } namespace units { template<typename T> struct heterogeneous_system; } }
namespace boost { namespace units { template<typename L> struct homogeneous_system; } }
Stream input and output for rationals, units and quantities.
Functions and manipulators for output and input of units and quantities. symbol and name format, and engineering and binary autoprefix. Serialization output is also supported.
namespace boost { namespace serialization { // Boost Serialization library support for units. template<typename Archive, typename System, typename Dim> void serialize(Archive &, boost::units::unit< Dim, System > &, const unsigned int); // Boost Serialization library support for quantities. template<typename Archive, typename Unit, typename Y> void serialize(Archive & ar, boost::units::quantity< Unit, Y > & q, const unsigned int); } namespace units { template<typename BaseUnit> struct base_unit_info; // format of output of units, for example "m" or "meter". enum format_mode { symbol_fmt = 0, name_fmt = 1, raw_fmt = 2, typename_fmt = 3, fmt_mask = 3 }; // automatic scaling and prefix (controlled by value of quantity) a, if any, enum autoprefix_mode { autoprefix_none = 0, autoprefix_engineering = 4, autoprefix_binary = 8, autoprefix_mask = 12 }; template<typename T> std::string to_string(const T & t); // get string representation of integral-valuedstatic_rational
. template<integer_type N> std::string to_string(const static_rational< N > &); // get string representation ofstatic_rational
. template<integer_type N, integer_type D> std::string to_string(const static_rational< N, D > &); // Writestatic_rational
tostd::basic_ostream
. template<typename Char, typename Traits, integer_type N, integer_type D> std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > & os, const static_rational< N, D > & r); // returns flags controlling output. long get_flags(std::ios_base & ios, long mask); // Set new flags controlling output format. void set_flags(std::ios_base & ios, long new_flags, long mask); // returns flags controlling output format. format_mode get_format(std::ios_base & ios); // Set new flags controlling output format. void set_format(std::ios_base & ios, format_mode new_mode); // Set new flags for type_name output format. std::ios_base & typename_format(std::ios_base & ios); // set new flag for raw format output, for example "m". std::ios_base & raw_format(std::ios_base & ios); // set new format flag for symbol output, for example "m". std::ios_base & symbol_format(std::ios_base & ios); // set new format for name output, for example "meter". std::ios_base & name_format(std::ios_base & ios); // get autoprefix flags for output. autoprefix_mode get_autoprefix(std::ios_base & ios); // Get format for output. void set_autoprefix(std::ios_base & ios, autoprefix_mode new_mode); // Clear autoprefix flags. std::ios_base & no_prefix(std::ios_base & ios); // Set flag for engineering prefix, so 1234.5 m displays as "1.2345 km". std::ios_base & engineering_prefix(std::ios_base & ios); // Set flag for binary prefix, so 1024 byte displays as "1 Kib". std::ios_base & binary_prefix(std::ios_base & ios); // ADL customization point for automatic prefixing. Returns a non-negative value. Implemented as std::abs for built-in types. template<typename T> double autoprefix_norm(const T & arg); template<typename Dimension, typename System> std::string typename_string(const unit< Dimension, System > &); template<typename Dimension, typename System> std::string symbol_string(const unit< Dimension, System > &); template<typename Dimension, typename System> std::string name_string(const unit< Dimension, System > &); template<typename Char, typename Traits, typename Dimension, typename System> std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &, const unit< Dimension, System > &); template<typename Char, typename Traits, typename Unit, typename T> std::basic_ostream< Char, Traits > & operator<<(std::basic_ostream< Char, Traits > &, const quantity< Unit, T > &); } }
Check that a type is a valid dim
.
namespace boost { namespace units { template<typename T> struct is_dim; template<typename T, typename V> struct is_dim<dim< T, V >>; } }
Check that a type is a valid dimension list.
namespace boost { namespace units { template<typename Seq> struct is_dimension_list; template<typename Item, typename Next> struct is_dimension_list<list< Item, Next >>; template<> struct is_dimension_list<dimensionless_type>; } }
Check if a unit or quantity is dimensionless.
namespace boost { namespace units { template<typename T> struct is_dimensionless; template<typename System> struct is_dimensionless<unit< dimensionless_type, System >>; template<typename Unit, typename Y> struct is_dimensionless<quantity< Unit, Y >>; } }
check that a type is a dimensionless quantity
namespace boost { namespace units { template<typename T> struct is_dimensionless_quantity; } }
Check that a type is a dimensionless unit.
namespace boost { namespace units { template<typename T> struct is_dimensionless_unit; } }
Check that a type is a quantity.
namespace boost { namespace units { template<typename T> struct is_quantity; template<typename Unit, typename Y> struct is_quantity<quantity< Unit, Y >>; } }
Check that a type is a quantity of the specified dimension.
namespace boost { namespace units { template<typename T, typename Dim> struct is_quantity_of_dimension; template<typename Unit, typename Y, typename Dim> struct is_quantity_of_dimension<quantity< Unit, Y >, Dim>; } }
Check that a type is a quantity in a specified system.
namespace boost { namespace units { template<typename T, typename System> struct is_quantity_of_system; template<typename Unit, typename Y, typename System> struct is_quantity_of_system<quantity< Unit, Y >, System>; } }
Check that a type is a unit.
namespace boost { namespace units { template<typename T> struct is_unit; template<typename Dim, typename System> struct is_unit<unit< Dim, System >>; } }
Check that a type is a unit of the specified dimension.
namespace boost { namespace units { template<typename T, typename Dim> struct is_unit_of_dimension; template<typename Dim, typename System> struct is_unit_of_dimension<unit< Dim, System >, Dim>; template<typename Dim, typename System> struct is_unit_of_dimension<absolute< unit< Dim, System > >, Dim>; } }
Check that a type is a unit in a specified system.
namespace boost { namespace units { template<typename T, typename System> struct is_unit_of_system; template<typename Dim, typename System> struct is_unit_of_system<unit< Dim, System >, System>; template<typename Dim, typename System> struct is_unit_of_system<absolute< unit< Dim, System > >, System>; } }
Definitions to ease the usage of Boost.Units' quantity, unit, and absolute types in functors created with the Boost.Lambda library.
Torsten Maehne
2008-06-16
Boost.Lambda's return type deduction system is extented to make use of Boost.Units' typeof_helper trait classes for Boost.Units' quantity, absolute, and unit template classes.
namespace boost { namespace lambda { template<typename System, typename Dim, typename Y> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::unit< Dim, System >, Y>; template<typename System, typename Dim, typename Y> struct plain_return_type_2<arithmetic_action< divide_action >, boost::units::unit< Dim, System >, Y>; template<typename System, typename Dim, typename Y> struct plain_return_type_2<arithmetic_action< multiply_action >, Y, boost::units::unit< Dim, System >>; template<typename System, typename Dim, typename Y> struct plain_return_type_2<arithmetic_action< divide_action >, Y, boost::units::unit< Dim, System >>; template<typename Unit, typename X> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::quantity< Unit, X >, X>; template<typename Unit, typename X> struct plain_return_type_2<arithmetic_action< multiply_action >, X, boost::units::quantity< Unit, X >>; template<typename Unit, typename X> struct plain_return_type_2<arithmetic_action< divide_action >, boost::units::quantity< Unit, X >, X>; template<typename Unit, typename X> struct plain_return_type_2<arithmetic_action< divide_action >, X, boost::units::quantity< Unit, X >>; template<typename System1, typename Dim1, typename Unit2, typename Y> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::unit< Dim1, System1 >, boost::units::quantity< Unit2, Y >>; template<typename System1, typename Dim1, typename Unit2, typename Y> struct plain_return_type_2<arithmetic_action< divide_action >, boost::units::unit< Dim1, System1 >, boost::units::quantity< Unit2, Y >>; template<typename Unit1, typename Y, typename System2, typename Dim2> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::quantity< Unit1, Y >, boost::units::unit< Dim2, System2 >>; template<typename Unit1, typename Y, typename System2, typename Dim2> struct plain_return_type_2<arithmetic_action< divide_action >, boost::units::quantity< Unit1, Y >, boost::units::unit< Dim2, System2 >>; template<typename Unit, typename Y> struct plain_return_type_1<unary_arithmetic_action< plus_action >, boost::units::quantity< Unit, Y >>; template<typename Unit, typename Y> struct plain_return_type_1<unary_arithmetic_action< minus_action >, boost::units::quantity< Unit, Y >>; template<typename Unit1, typename X, typename Unit2, typename Y> struct plain_return_type_2<arithmetic_action< plus_action >, boost::units::quantity< Unit1, X >, boost::units::quantity< Unit2, Y >>; template<typename System, typename X, typename Y> struct plain_return_type_2<arithmetic_action< plus_action >, boost::units::quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(System), X >, Y>; template<typename System, typename X, typename Y> struct plain_return_type_2<arithmetic_action< plus_action >, X, boost::units::quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(System), Y >>; template<typename Unit1, typename X, typename Unit2, typename Y> struct plain_return_type_2<arithmetic_action< minus_action >, boost::units::quantity< Unit1, X >, boost::units::quantity< Unit2, Y >>; template<typename System, typename X, typename Y> struct plain_return_type_2<arithmetic_action< minus_action >, boost::units::quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(System), X >, Y>; template<typename System, typename X, typename Y> struct plain_return_type_2<arithmetic_action< minus_action >, X, boost::units::quantity< BOOST_UNITS_DIMENSIONLESS_UNIT(System), Y >>; template<typename Unit1, typename X, typename Unit2, typename Y> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::quantity< Unit1, X >, boost::units::quantity< Unit2, Y >>; template<typename Unit1, typename X, typename Unit2, typename Y> struct plain_return_type_2<arithmetic_action< divide_action >, boost::units::quantity< Unit1, X >, boost::units::quantity< Unit2, Y >>; template<typename Dim, typename System> struct plain_return_type_1<unary_arithmetic_action< plus_action >, boost::units::unit< Dim, System >>; template<typename Dim, typename System> struct plain_return_type_1<unary_arithmetic_action< minus_action >, boost::units::unit< Dim, System >>; template<typename Dim1, typename Dim2, typename System1, typename System2> struct plain_return_type_2<arithmetic_action< plus_action >, boost::units::unit< Dim1, System1 >, boost::units::unit< Dim2, System2 >>; template<typename Dim1, typename Dim2, typename System1, typename System2> struct plain_return_type_2<arithmetic_action< minus_action >, boost::units::unit< Dim1, System1 >, boost::units::unit< Dim2, System2 >>; template<typename Dim1, typename Dim2, typename System1, typename System2> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::unit< Dim1, System1 >, boost::units::unit< Dim2, System2 >>; template<typename Dim1, typename Dim2, typename System1, typename System2> struct plain_return_type_2<arithmetic_action< divide_action >, boost::units::unit< Dim1, System1 >, boost::units::unit< Dim2, System2 >>; template<typename Y> struct plain_return_type_2<arithmetic_action< plus_action >, boost::units::absolute< Y >, Y>; template<typename Y> struct plain_return_type_2<arithmetic_action< plus_action >, Y, boost::units::absolute< Y >>; template<typename Y> struct plain_return_type_2<arithmetic_action< minus_action >, boost::units::absolute< Y >, Y>; template<typename Y> struct plain_return_type_2<arithmetic_action< minus_action >, boost::units::absolute< Y >, boost::units::absolute< Y >>; template<typename D, typename S, typename T> struct plain_return_type_2<arithmetic_action< multiply_action >, T, boost::units::absolute< boost::units::unit< D, S > >>; template<typename D, typename S, typename T> struct plain_return_type_2<arithmetic_action< multiply_action >, boost::units::absolute< boost::units::unit< D, S > >, T>; } namespace units { template<typename System, typename Dim, typename Arg> struct multiply_typeof_helper<boost::units::unit< Dim, System >, boost::lambda::lambda_functor< Arg >>; template<typename System, typename Dim, typename Arg> struct divide_typeof_helper<boost::units::unit< Dim, System >, boost::lambda::lambda_functor< Arg >>; template<typename System, typename Dim, typename Arg> struct multiply_typeof_helper<boost::lambda::lambda_functor< Arg >, boost::units::unit< Dim, System >>; template<typename System, typename Dim, typename Arg> struct divide_typeof_helper<boost::lambda::lambda_functor< Arg >, boost::units::unit< Dim, System >>; template<typename System, typename Dim, typename Arg> struct multiply_typeof_helper<boost::lambda::lambda_functor< Arg >, boost::units::absolute< boost::units::unit< Dim, System > >>; template<typename System, typename Dim, typename Arg> struct multiply_typeof_helper<boost::units::absolute< boost::units::unit< Dim, System > >, boost::lambda::lambda_functor< Arg >>; template<typename System, typename Dim, typename Arg> const multiply_typeof_helper< boost::units::unit< Dim, System >, boost::lambda::lambda_functor< Arg > >::type operator*(const boost::units::unit< Dim, System > &, const boost::lambda::lambda_functor< Arg > &); template<typename System, typename Dim, typename Arg> const divide_typeof_helper< boost::units::unit< Dim, System >, boost::lambda::lambda_functor< Arg > >::type operator/(const boost::units::unit< Dim, System > &, const boost::lambda::lambda_functor< Arg > &); template<typename System, typename Dim, typename Arg> const multiply_typeof_helper< boost::lambda::lambda_functor< Arg >, boost::units::unit< Dim, System > >::type operator*(const boost::lambda::lambda_functor< Arg > &, const boost::units::unit< Dim, System > &); template<typename System, typename Dim, typename Arg> const divide_typeof_helper< boost::lambda::lambda_functor< Arg >, boost::units::unit< Dim, System > >::type operator/(const boost::lambda::lambda_functor< Arg > &, const boost::units::unit< Dim, System > &); template<typename System, typename Dim, typename Arg> const multiply_typeof_helper< boost::lambda::lambda_functor< Arg >, boost::units::absolute< boost::units::unit< Dim, System > > >::type operator*(const boost::lambda::lambda_functor< Arg > &, const boost::units::absolute< boost::units::unit< Dim, System > > &); template<typename System, typename Dim, typename Arg> const multiply_typeof_helper< boost::units::absolute< boost::units::unit< Dim, System > >, boost::lambda::lambda_functor< Arg > >::type operator*(const boost::units::absolute< boost::units::unit< Dim, System > > &, const boost::lambda::lambda_functor< Arg > &); } }
specialize std::numeric_limits for units.
namespace std { template<typename Unit, typename T> class numeric_limits<::boost::units::quantity< Unit, T >>; }
namespace boost { namespace units { template<typename Unit, typename Scale> struct make_scaled_unit; template<typename Dimension, typename UnitList, typename OldScale, typename Scale> struct make_scaled_unit<unit< Dimension, heterogeneous_system< heterogeneous_system_impl< UnitList, Dimension, OldScale > > >, Scale>; template<typename Dimension, typename UnitList, typename OldScale, long Base> struct make_scaled_unit<unit< Dimension, heterogeneous_system< heterogeneous_system_impl< UnitList, Dimension, OldScale > > >, scale< Base, static_rational< 0 > >>; } }
Metafunction returning a homogeneous system that can represent any combination of the base units.
Metafunction make_system returning a homogeneous system that can represent any combination of the base units. There must be no way to represent any of the base units in terms of the others. make_system<foot_base_unit, meter_base_unit>::type is not allowed, for example.
namespace boost { namespace units { template<typename BaseUnit0, typename BaseUnit1, typename BaseUnit2, ... , typename BaseUnitN> struct make_system; } }
Compile time operators and typeof helper classes.
These operators declare the compile-time operators needed to support dimensional analysis algebra. They require the use of Boost.Typeof, emulation or native. Typeof helper classes define result type for heterogeneous operators on value types. These must be defined through specialization for powers and roots.
namespace boost { namespace units { template<typename X> struct unary_plus_typeof_helper; template<typename X> struct unary_minus_typeof_helper; template<typename X, typename Y> struct add_typeof_helper; template<typename X, typename Y> struct subtract_typeof_helper; template<typename X, typename Y> struct multiply_typeof_helper; template<typename X, typename Y> struct divide_typeof_helper; template<typename BaseType, typename Exponent> struct power_typeof_helper; template<typename Radicand, typename Index> struct root_typeof_helper; } }
Raise values to exponents known at compile-time.
namespace boost { namespace units { template<typename Rat, typename Y> power_typeof_helper< Y, Rat >::type pow(const Y &); template<typename Rat, typename Y> root_typeof_helper< Y, Rat >::type root(const Y &); } }
namespace boost { namespace units { template<typename Unit, typename Y> class quantity; template<typename System, typename Y> class quantity<BOOST_UNITS_DIMENSIONLESS_UNIT(System), Y>; template<typename Dim1, typename System1, typename Dim2, typename System2, typename X, typename Y> struct add_typeof_helper<quantity< unit< Dim1, System1 >, X >, quantity< unit< Dim2, System2 >, Y >>; template<typename Dim, typename System, typename X, typename Y> struct add_typeof_helper<quantity< unit< Dim, System >, X >, quantity< unit< Dim, System >, Y >>; template<typename Dim1, typename System1, typename Dim2, typename System2, typename X, typename Y> struct subtract_typeof_helper<quantity< unit< Dim1, System1 >, X >, quantity< unit< Dim2, System2 >, Y >>; template<typename Dim, typename System, typename X, typename Y> struct subtract_typeof_helper<quantity< unit< Dim, System >, X >, quantity< unit< Dim, System >, Y >>; // quantity_cast provides mutating access to underlying quantity value_type template<typename X, typename Y> X quantity_cast(Y & source); template<typename X, typename Y> X quantity_cast(const Y & source); // swap quantities template<typename Unit, typename Y> void swap(quantity< Unit, Y > & lhs, quantity< Unit, Y > & rhs); // runtime unit divided by scalar template<typename System, typename Dim, typename Y> divide_typeof_helper< unit< Dim, System >, Y >::type operator/(const unit< Dim, System > &, const Y & rhs); // runtime scalar times unit template<typename System, typename Dim, typename Y> multiply_typeof_helper< Y, unit< Dim, System > >::type operator*(const Y & lhs, const unit< Dim, System > &); // runtime scalar divided by unit template<typename System, typename Dim, typename Y> divide_typeof_helper< Y, unit< Dim, System > >::type operator/(const Y & lhs, const unit< Dim, System > &); // runtime quantity times scalar template<typename Unit, typename X> multiply_typeof_helper< quantity< Unit, X >, X >::type operator*(const quantity< Unit, X > & lhs, const X & rhs); // runtime scalar times quantity template<typename Unit, typename X> multiply_typeof_helper< X, quantity< Unit, X > >::type operator*(const X & lhs, const quantity< Unit, X > & rhs); // runtime quantity divided by scalar template<typename Unit, typename X> divide_typeof_helper< quantity< Unit, X >, X >::type operator/(const quantity< Unit, X > & lhs, const X & rhs); // runtime scalar divided by quantity template<typename Unit, typename X> divide_typeof_helper< X, quantity< Unit, X > >::type operator/(const X & lhs, const quantity< Unit, X > & rhs); // runtime unit times quantity template<typename System1, typename Dim1, typename Unit2, typename Y> multiply_typeof_helper< unit< Dim1, System1 >, quantity< Unit2, Y > >::type operator*(const unit< Dim1, System1 > &, const quantity< Unit2, Y > & rhs); // runtime unit divided by quantity template<typename System1, typename Dim1, typename Unit2, typename Y> divide_typeof_helper< unit< Dim1, System1 >, quantity< Unit2, Y > >::type operator/(const unit< Dim1, System1 > &, const quantity< Unit2, Y > & rhs); // runtime quantity times unit template<typename Unit1, typename System2, typename Dim2, typename Y> multiply_typeof_helper< quantity< Unit1, Y >, unit< Dim2, System2 > >::type operator*(const quantity< Unit1, Y > & lhs, const unit< Dim2, System2 > &); // runtime quantity divided by unit template<typename Unit1, typename System2, typename Dim2, typename Y> divide_typeof_helper< quantity< Unit1, Y >, unit< Dim2, System2 > >::type operator/(const quantity< Unit1, Y > & lhs, const unit< Dim2, System2 > &); // runtime unary plus quantity template<typename Unit, typename Y> unary_plus_typeof_helper< quantity< Unit, Y > >::type operator+(const quantity< Unit, Y > & val); // runtime unary minus quantity template<typename Unit, typename Y> unary_minus_typeof_helper< quantity< Unit, Y > >::type operator-(const quantity< Unit, Y > & val); // runtime quantity plus quantity template<typename Unit1, typename Unit2, typename X, typename Y> add_typeof_helper< quantity< Unit1, X >, quantity< Unit2, Y > >::type operator+(const quantity< Unit1, X > & lhs, const quantity< Unit2, Y > & rhs); // runtime quantity minus quantity template<typename Unit1, typename Unit2, typename X, typename Y> subtract_typeof_helper< quantity< Unit1, X >, quantity< Unit2, Y > >::type operator-(const quantity< Unit1, X > & lhs, const quantity< Unit2, Y > & rhs); // runtime quantity times quantity template<typename Unit1, typename Unit2, typename X, typename Y> multiply_typeof_helper< quantity< Unit1, X >, quantity< Unit2, Y > >::type operator*(const quantity< Unit1, X > & lhs, const quantity< Unit2, Y > & rhs); // runtime quantity divided by quantity template<typename Unit1, typename Unit2, typename X, typename Y> divide_typeof_helper< quantity< Unit1, X >, quantity< Unit2, Y > >::type operator/(const quantity< Unit1, X > & lhs, const quantity< Unit2, Y > & rhs); // runtime operator== template<typename Unit, typename X, typename Y> bool operator==(const quantity< Unit, X > & val1, const quantity< Unit, Y > & val2); // runtime operator!= template<typename Unit, typename X, typename Y> bool operator!=(const quantity< Unit, X > & val1, const quantity< Unit, Y > & val2); // runtime operator< template<typename Unit, typename X, typename Y> bool operator<(const quantity< Unit, X > & val1, const quantity< Unit, Y > & val2); // runtime operator<= template<typename Unit, typename X, typename Y> bool operator<=(const quantity< Unit, X > & val1, const quantity< Unit, Y > & val2); // runtime operator> template<typename Unit, typename X, typename Y> bool operator>(const quantity< Unit, X > & val1, const quantity< Unit, Y > & val2); // runtime operator>= template<typename Unit, typename X, typename Y> bool operator>=(const quantity< Unit, X > & val1, const quantity< Unit, Y > & val2); } }
Returns a unique type for every unit.
namespace boost { namespace units { template<typename Unit> struct reduce_unit; } }
10^3 Engineering & 2^10 binary scaling factors for autoprefixing.
namespace boost { namespace units { template<long Base, typename Exponent> struct scale; template<long Base, typename Exponent> std::string symbol_string(const scale< Base, Exponent > &); template<long Base, typename Exponent> std::string name_string(const scale< Base, Exponent > &); } }
namespace boost { namespace units { template<typename S, typename Scale> struct scaled_base_unit; } }
BOOST_UNITS_STATIC_CONSTANT(name, type)
Compile-time rational numbers and operators.
namespace boost {
namespace units {
template<integer_type Value> struct static_abs;
template<integer_type N, integer_type D = 1> class static_rational;
typedef long integer_type;
// get decimal value of static_rational
template<typename T, integer_type N, integer_type D>
divide_typeof_helper< T, T >::type
value(const static_rational< N, D > &);
}
}
namespace boost { namespace units { template<typename Dim, typename System, typename Enable> class unit; template<typename Dim, typename System> struct reduce_unit<unit< Dim, System >>; template<typename Dim, typename System, long N, long D> struct power_typeof_helper<unit< Dim, System >, static_rational< N, D >>; template<typename Dim, typename System, long N, long D> struct root_typeof_helper<unit< Dim, System >, static_rational< N, D >>; // unit runtime unary plus template<typename Dim, typename System> unary_plus_typeof_helper< unit< Dim, System > >::type operator+(const unit< Dim, System > &); // unit runtime unary minus template<typename Dim, typename System> unary_minus_typeof_helper< unit< Dim, System > >::type operator-(const unit< Dim, System > &); // runtime add two units template<typename Dim1, typename Dim2, typename System1, typename System2> add_typeof_helper< unit< Dim1, System1 >, unit< Dim2, System2 > >::type operator+(const unit< Dim1, System1 > &, const unit< Dim2, System2 > &); // runtime subtract two units template<typename Dim1, typename Dim2, typename System1, typename System2> subtract_typeof_helper< unit< Dim1, System1 >, unit< Dim2, System2 > >::type operator-(const unit< Dim1, System1 > &, const unit< Dim2, System2 > &); // runtime multiply two units template<typename Dim1, typename Dim2, typename System1, typename System2> multiply_typeof_helper< unit< Dim1, System1 >, unit< Dim2, System2 > >::type operator*(const unit< Dim1, System1 > &, const unit< Dim2, System2 > &); // runtime divide two units template<typename Dim1, typename Dim2, typename System1, typename System2> divide_typeof_helper< unit< Dim1, System1 >, unit< Dim2, System2 > >::type operator/(const unit< Dim1, System1 > &, const unit< Dim2, System2 > &); // unit runtimeoperator==
template<typename Dim1, typename Dim2, typename System1, typename System2> bool operator==(const unit< Dim1, System1 > &, const unit< Dim2, System2 > &); // unit runtimeoperator!=
template<typename Dim1, typename Dim2, typename System1, typename System2> bool operator!=(const unit< Dim1, System1 > &, const unit< Dim2, System2 > &); } }
Forward declarations of library components.
Forward declarations of units library - dimensions, systems, quantity and string components.