| 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) 2007-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_DETAIL_ORDINAL_HPP_INCLUDED |
| 12 | #define BOOST_UNITS_DETAIL_ORDINAL_HPP_INCLUDED |
| 13 | |
| 14 | #include <boost/mpl/less.hpp> |
| 15 | #include <boost/mpl/bool.hpp> |
| 16 | |
| 17 | namespace boost { |
| 18 | namespace units { |
| 19 | |
| 20 | namespace detail { |
| 21 | |
| 22 | struct ordinal_tag {}; |
| 23 | |
| 24 | } |
| 25 | |
| 26 | template<int N> |
| 27 | struct ordinal { |
| 28 | typedef detail::ordinal_tag tag; |
| 29 | BOOST_STATIC_CONSTEXPR long value = N; |
| 30 | }; |
| 31 | |
| 32 | template<int N> |
| 33 | BOOST_CONSTEXPR_OR_CONST long ordinal<N>::value; |
| 34 | |
| 35 | } |
| 36 | |
| 37 | namespace mpl { |
| 38 | |
| 39 | template<> |
| 40 | struct less_impl<units::detail::ordinal_tag, units::detail::ordinal_tag> { |
| 41 | template<class T1, class T2> |
| 42 | struct apply : bool_<(T1::value) < (T2::value)> {}; |
| 43 | }; |
| 44 | |
| 45 | } |
| 46 | |
| 47 | } |
| 48 | |
| 49 | #endif |
| 50 | |