]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/units/detail/dim_impl.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / units / detail / dim_impl.hpp
1 // Boost.Units - A C++ library for zero-overhead dimensional analysis and
2 // unit/quantity manipulation and conversion
3 //
4 // Copyright (C) 2003-2008 Matthias Christian Schabel
5 // Copyright (C) 2008 Steven Watanabe
6 //
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)
10
11 #ifndef BOOST_UNITS_DIM_IMPL_HPP
12 #define BOOST_UNITS_DIM_IMPL_HPP
13
14 #include <boost/mpl/bool.hpp>
15 #include <boost/mpl/less.hpp>
16
17 #include <boost/units/units_fwd.hpp>
18
19 /// \file
20 /// \brief Class encapsulating a dimension tag/value pair
21
22 namespace boost {
23
24 namespace units {
25
26 namespace detail {
27
28 struct dim_tag;
29
30 }
31
32 }
33
34 namespace mpl {
35
36 /// Less than comparison for sorting @c dim.
37 template<>
38 struct less_impl<boost::units::detail::dim_tag, boost::units::detail::dim_tag>
39 {
40 template<class T0, class T1>
41 struct apply : mpl::less<typename T0::tag_type, typename T1::tag_type> {};
42 };
43
44 }
45
46 namespace units {
47
48 template<class Tag, class Exponent>
49 struct dim;
50
51 template<long N, long D>
52 class static_rational;
53
54 namespace detail {
55
56 /// Extract @c tag_type from a @c dim.
57 template<typename T>
58 struct get_tag
59 {
60 typedef typename T::tag_type type;
61 };
62
63 /// Extract @c value_type from a @c dim.
64 template<typename T>
65 struct get_value
66 {
67 typedef typename T::value_type type;
68 };
69
70 /// Determine if a @c dim is empty (has a zero exponent).
71 template<class T>
72 struct is_empty_dim;
73
74 template<typename T>
75 struct is_empty_dim< dim<T, static_rational<0, 1> > > :
76 mpl::true_
77 { };
78
79 template<typename T, typename V>
80 struct is_empty_dim< dim<T, V> > :
81 mpl::false_
82 { };
83
84 } // namespace detail
85
86 } // namespace units
87
88 } // namespace boost
89
90 #endif // BOOST_UNITS_DIM_IMPL_HPP