]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/units/include/boost/units/detail/dimension_list.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / units / include / boost / units / detail / dimension_list.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_DIMENSION_LIST_HPP
12 #define BOOST_UNITS_DIMENSION_LIST_HPP
13
14 #include <boost/mpl/next.hpp>
15 #include <boost/mpl/deref.hpp>
16 #include <boost/mpl/push_front_fwd.hpp>
17 #include <boost/mpl/pop_front_fwd.hpp>
18 #include <boost/mpl/size_fwd.hpp>
19 #include <boost/mpl/begin_end_fwd.hpp>
20 #include <boost/mpl/front_fwd.hpp>
21
22 #include <boost/units/config.hpp>
23
24 namespace boost {
25
26 namespace units {
27
28 struct dimensionless_type;
29
30 namespace detail {
31
32 struct dimension_list_tag { };
33
34 } // namespace detail
35
36 template<class Item, class Next>
37 struct list
38 {
39 typedef detail::dimension_list_tag tag;
40 typedef list type;
41 typedef Item item;
42 typedef Next next;
43 typedef typename mpl::next<typename Next::size>::type size;
44 };
45
46 } // namespace units
47
48 namespace mpl {
49
50 // INTERNAL ONLY
51 template<>
52 struct size_impl<units::detail::dimension_list_tag>
53 {
54 template<class L> struct apply : public L::size { };
55 };
56
57 // INTERNAL ONLY
58 template<>
59 struct begin_impl<units::detail::dimension_list_tag>
60 {
61 template<class L>
62 struct apply
63 {
64 typedef L type;
65 };
66 };
67
68 // INTERNAL ONLY
69 template<>
70 struct end_impl<units::detail::dimension_list_tag>
71 {
72 template<class L>
73 struct apply
74 {
75 typedef units::dimensionless_type type;
76 };
77 };
78
79 // INTERNAL ONLY
80 template<>
81 struct push_front_impl<units::detail::dimension_list_tag>
82 {
83 template<class L, class T>
84 struct apply
85 {
86 typedef units::list<T, L> type;
87 };
88 };
89
90 // INTERNAL ONLY
91 template<>
92 struct pop_front_impl<units::detail::dimension_list_tag>
93 {
94 template<class L>
95 struct apply
96 {
97 typedef typename L::next type;
98 };
99 };
100
101 // INTERNAL ONLY
102 template<>
103 struct front_impl<units::detail::dimension_list_tag>
104 {
105 template<class L>
106 struct apply
107 {
108 typedef typename L::item type;
109 };
110 };
111
112 // INTERNAL ONLY
113 template<class Item, class Next>
114 struct deref<units::list<Item, Next> >
115 {
116 typedef Item type;
117 };
118
119 } // namespace mpl
120
121 } // namespace boost
122
123 #if BOOST_UNITS_HAS_BOOST_TYPEOF
124
125 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
126
127 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::list, 2)
128
129 #endif
130
131 #include <boost/units/dimensionless_type.hpp>
132
133 #endif // BOOST_UNITS_DIMENSION_LIST_HPP