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) 2007-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_DETAIL_DIMENSIONLESS_UNIT_HPP
12 #define BOOST_UNITS_DETAIL_DIMENSIONLESS_UNIT_HPP
14 #include <boost/mpl/bool.hpp>
15 #include <boost/units/units_fwd.hpp>
21 struct heterogeneous_system;
24 struct homogeneous_system;
26 template<class T1, class T2, class Scale>
27 struct heterogeneous_system_impl;
29 typedef boost::units::heterogeneous_system<
30 boost::units::heterogeneous_system_impl<
31 boost::units::dimensionless_type,
32 boost::units::dimensionless_type,
33 boost::units::dimensionless_type
35 > heterogeneous_dimensionless_system;
39 template<class System>
40 struct void_if_dimensionless {
45 struct void_if_dimensionless<boost::units::homogeneous_system<T> > {
50 struct void_if_dimensionless<heterogeneous_dimensionless_system> {
54 template<class System, class Test = void>
55 struct void_if_heterogeneous {
59 template<class System>
60 struct void_if_heterogeneous<System, typename void_if_dimensionless<System>::type> {
64 template<class System, class Enable=void>
65 struct is_dimensionless_system : mpl::false_ {};
67 template<class System>
68 struct is_dimensionless_system<System, typename void_if_dimensionless<System>::type> : mpl::true_ {};
70 #define BOOST_UNITS_DIMENSIONLESS_UNIT(T)\
72 boost::units::dimensionless_type,\
74 typename ::boost::units::detail::void_if_dimensionless<T>::type\
77 #define BOOST_UNITS_HETEROGENEOUS_DIMENSIONLESS_UNIT(T)\
79 boost::units::dimensionless_type,\
81 typename ::boost::units::detail::void_if_heterogeneous<T>::type\