File indexing completed on 2025-01-18 09:53:13
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_UNITS_DETAIL_DIMENSIONLESS_UNIT_HPP
0012 #define BOOST_UNITS_DETAIL_DIMENSIONLESS_UNIT_HPP
0013
0014 #include <boost/mpl/bool.hpp>
0015 #include <boost/units/units_fwd.hpp>
0016
0017 namespace boost {
0018 namespace units {
0019
0020 template<class T>
0021 struct heterogeneous_system;
0022
0023 template<class T>
0024 struct homogeneous_system;
0025
0026 template<class T1, class T2, class Scale>
0027 struct heterogeneous_system_impl;
0028
0029 typedef boost::units::heterogeneous_system<
0030 boost::units::heterogeneous_system_impl<
0031 boost::units::dimensionless_type,
0032 boost::units::dimensionless_type,
0033 boost::units::dimensionless_type
0034 >
0035 > heterogeneous_dimensionless_system;
0036
0037 namespace detail {
0038
0039 template<class System>
0040 struct void_if_dimensionless {
0041 typedef int type;
0042 };
0043
0044 template<class T>
0045 struct void_if_dimensionless<boost::units::homogeneous_system<T> > {
0046 typedef void type;
0047 };
0048
0049 template<>
0050 struct void_if_dimensionless<heterogeneous_dimensionless_system> {
0051 typedef void type;
0052 };
0053
0054 template<class System, class Test = void>
0055 struct void_if_heterogeneous {
0056 typedef void type;
0057 };
0058
0059 template<class System>
0060 struct void_if_heterogeneous<System, typename void_if_dimensionless<System>::type> {
0061 typedef int type;
0062 };
0063
0064 template<class System, class Enable=void>
0065 struct is_dimensionless_system : mpl::false_ {};
0066
0067 template<class System>
0068 struct is_dimensionless_system<System, typename void_if_dimensionless<System>::type> : mpl::true_ {};
0069
0070 #define BOOST_UNITS_DIMENSIONLESS_UNIT(T)\
0071 boost::units::unit<\
0072 boost::units::dimensionless_type,\
0073 T,\
0074 typename ::boost::units::detail::void_if_dimensionless<T>::type\
0075 >
0076
0077 #define BOOST_UNITS_HETEROGENEOUS_DIMENSIONLESS_UNIT(T)\
0078 boost::units::unit<\
0079 boost::units::dimensionless_type,\
0080 T,\
0081 typename ::boost::units::detail::void_if_heterogeneous<T>::type\
0082 >
0083
0084 }
0085 }
0086 }
0087
0088 #endif