Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:13

0001 // Boost.Units - A C++ library for zero-overhead dimensional analysis and 
0002 // unit/quantity manipulation and conversion
0003 //
0004 // Copyright (C) 2003-2008 Matthias Christian Schabel
0005 // Copyright (C) 2008 Steven Watanabe
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See
0008 // accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_UNITS_DIM_IMPL_HPP
0012 #define BOOST_UNITS_DIM_IMPL_HPP
0013 
0014 #include <boost/mpl/bool.hpp>
0015 #include <boost/mpl/less.hpp>
0016 
0017 #include <boost/units/units_fwd.hpp>
0018 
0019 /// \file 
0020 /// \brief Class encapsulating a dimension tag/value pair
0021 
0022 namespace boost {
0023 
0024 namespace units {
0025 
0026 namespace detail {
0027 
0028 struct dim_tag;
0029 
0030 }
0031 
0032 }
0033 
0034 namespace mpl {
0035 
0036 /// Less than comparison for sorting @c dim.
0037 template<>
0038 struct less_impl<boost::units::detail::dim_tag, boost::units::detail::dim_tag>
0039 {
0040     template<class T0, class T1>
0041     struct apply : mpl::less<typename T0::tag_type, typename T1::tag_type> {};
0042 };
0043 
0044 }
0045 
0046 namespace units {
0047 
0048 template<class Tag, class Exponent>
0049 struct dim;
0050 
0051 template<long N, long D>
0052 class static_rational;
0053 
0054 namespace detail {
0055 
0056 /// Extract @c tag_type from a @c dim.
0057 template<typename T>
0058 struct get_tag
0059 {
0060     typedef typename T::tag_type    type;
0061 };
0062 
0063 /// Extract @c value_type from a @c dim.
0064 template<typename T>
0065 struct get_value
0066 {
0067     typedef typename T::value_type    type;
0068 };
0069 
0070 /// Determine if a @c dim is empty (has a zero exponent).
0071 template<class T>
0072 struct is_empty_dim;
0073 
0074 template<typename T>
0075 struct is_empty_dim< dim<T, static_rational<0, 1> > > :
0076     mpl::true_ 
0077 { };
0078 
0079 template<typename T, typename V>
0080 struct is_empty_dim< dim<T, V> > :
0081     mpl::false_ 
0082 { };
0083 
0084 } // namespace detail
0085 
0086 } // namespace units
0087 
0088 } // namespace boost
0089 
0090 #endif // BOOST_UNITS_DIM_IMPL_HPP