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) 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_DIMENSION_LIST_HPP
12 #define BOOST_UNITS_DIMENSION_LIST_HPP
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>
22 #include <boost/units/config.hpp>
28 struct dimensionless_type;
32 struct dimension_list_tag { };
36 template<class Item, class Next>
39 typedef detail::dimension_list_tag tag;
43 typedef typename mpl::next<typename Next::size>::type size;
52 struct size_impl<units::detail::dimension_list_tag>
54 template<class L> struct apply : public L::size { };
59 struct begin_impl<units::detail::dimension_list_tag>
70 struct end_impl<units::detail::dimension_list_tag>
75 typedef units::dimensionless_type type;
81 struct push_front_impl<units::detail::dimension_list_tag>
83 template<class L, class T>
86 typedef units::list<T, L> type;
92 struct pop_front_impl<units::detail::dimension_list_tag>
97 typedef typename L::next type;
103 struct front_impl<units::detail::dimension_list_tag>
108 typedef typename L::item type;
113 template<class Item, class Next>
114 struct deref<units::list<Item, Next> >
123 #if BOOST_UNITS_HAS_BOOST_TYPEOF
125 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
127 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::list, 2)
131 #include <boost/units/dimensionless_type.hpp>
133 #endif // BOOST_UNITS_DIMENSION_LIST_HPP