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_DIMENSION_LIST_HPP
0012 #define BOOST_UNITS_DIMENSION_LIST_HPP
0013 
0014 #include <boost/mpl/next.hpp>
0015 #include <boost/mpl/deref.hpp>
0016 #include <boost/mpl/push_front_fwd.hpp>
0017 #include <boost/mpl/pop_front_fwd.hpp>
0018 #include <boost/mpl/size_fwd.hpp>
0019 #include <boost/mpl/begin_end_fwd.hpp>
0020 #include <boost/mpl/front_fwd.hpp>
0021 
0022 #include <boost/units/config.hpp>
0023 
0024 namespace boost {
0025 
0026 namespace units {
0027 
0028 struct dimensionless_type;
0029 
0030 namespace detail {
0031 
0032 struct dimension_list_tag { };
0033 
0034 } // namespace detail
0035 
0036 template<class Item, class Next>
0037 struct list
0038 {
0039     typedef detail::dimension_list_tag  tag;
0040     typedef list              type;
0041     typedef Item                        item;
0042     typedef Next                        next;
0043     typedef typename mpl::next<typename Next::size>::type size;
0044 };
0045 
0046 } // namespace units
0047 
0048 namespace mpl {
0049 
0050 // INTERNAL ONLY
0051 template<>
0052 struct size_impl<units::detail::dimension_list_tag>
0053 {
0054     template<class L> struct apply : public L::size { };
0055 };
0056 
0057 // INTERNAL ONLY
0058 template<>
0059 struct begin_impl<units::detail::dimension_list_tag>
0060 {
0061     template<class L>
0062     struct apply 
0063     {
0064         typedef L type;
0065     };
0066 };
0067 
0068 // INTERNAL ONLY
0069 template<>
0070 struct end_impl<units::detail::dimension_list_tag>
0071 {
0072     template<class L>
0073     struct apply 
0074     {
0075         typedef units::dimensionless_type type;
0076     };
0077 };
0078 
0079 // INTERNAL ONLY
0080 template<>
0081 struct push_front_impl<units::detail::dimension_list_tag>
0082 {
0083     template<class L, class T>
0084     struct apply 
0085     {
0086         typedef units::list<T, L> type;
0087     };
0088 };
0089 
0090 // INTERNAL ONLY
0091 template<>
0092 struct pop_front_impl<units::detail::dimension_list_tag>
0093 {
0094     template<class L>
0095     struct apply 
0096     {
0097         typedef typename L::next type;
0098     };
0099 };
0100 
0101 // INTERNAL ONLY
0102 template<>
0103 struct front_impl<units::detail::dimension_list_tag>
0104 {
0105     template<class L>
0106     struct apply 
0107     {
0108         typedef typename L::item type;
0109     };
0110 };
0111 
0112 // INTERNAL ONLY
0113 template<class Item, class Next>
0114 struct deref<units::list<Item, Next> >
0115 {
0116     typedef Item type;
0117 };
0118 
0119 } // namespace mpl
0120 
0121 } // namespace boost
0122 
0123 #if BOOST_UNITS_HAS_BOOST_TYPEOF
0124 
0125 #include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
0126 
0127 BOOST_TYPEOF_REGISTER_TEMPLATE(boost::units::list, 2)
0128 
0129 #endif
0130 
0131 #include <boost/units/dimensionless_type.hpp>
0132 
0133 #endif // BOOST_UNITS_DIMENSION_LIST_HPP