1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
2 // unit/quantity manipulation and conversion
4 // Copyright (C) 2003-2008 Matthias Christian Schabel
5 // Copyright (C) 2008 Steven Watanabe
7 // Distributed under the Boost Software License, Version 1.0. (See
8 // accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
12 #define BOOST_UNITS_HOMOGENEOUS_SYSTEM_HPP_INCLUDED
14 #include <boost/mpl/bool.hpp>
16 #include <boost/units/config.hpp>
17 #include <boost/units/static_rational.hpp>
19 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
21 #include <boost/type_traits/is_same.hpp>
22 #include <boost/mpl/not.hpp>
24 #include <boost/units/detail/linear_algebra.hpp>
32 /// A system that can uniquely represent any unit
33 /// which can be composed from a linearly independent set
34 /// of base units. It is safe to rebind a unit with
35 /// such a system to different dimensions.
37 /// Do not construct this template directly. Use
38 /// make_system instead.
40 struct homogeneous_system {
45 template<class T, class E>
48 template<class T, class R>
52 template<class L, long N, long D>
53 struct static_power<homogeneous_system<L>, static_rational<N,D> >
55 typedef homogeneous_system<L> type;
59 template<class L, long N, long D>
60 struct static_root<homogeneous_system<L>, static_rational<N,D> >
62 typedef homogeneous_system<L> type;
67 template<class System, class Dimensions>
70 #ifdef BOOST_UNITS_CHECK_HOMOGENEOUS_UNITS
72 template<class L, class Dimensions>
73 struct check_system<homogeneous_system<L>, Dimensions> :
76 typename calculate_base_unit_exponents<
86 template<class L, class Dimensions>
87 struct check_system<homogeneous_system<L>, Dimensions> : mpl::true_ {};
97 #if BOOST_UNITS_HAS_BOOST_TYPEOF
99 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
101 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::homogeneous_system, (class))