ordinal.hpp 1017 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef BOOST_UNITS_DETAIL_ORDINAL_HPP_INCLUDED
  11. #define BOOST_UNITS_DETAIL_ORDINAL_HPP_INCLUDED
  12. #include <boost/mpl/less.hpp>
  13. #include <boost/mpl/bool.hpp>
  14. namespace boost {
  15. namespace units {
  16. namespace detail {
  17. struct ordinal_tag {};
  18. }
  19. template<int N>
  20. struct ordinal {
  21. typedef detail::ordinal_tag tag;
  22. BOOST_STATIC_CONSTEXPR long value = N;
  23. };
  24. template<int N>
  25. BOOST_CONSTEXPR_OR_CONST long ordinal<N>::value;
  26. }
  27. namespace mpl {
  28. template<>
  29. struct less_impl<units::detail::ordinal_tag, units::detail::ordinal_tag> {
  30. template<class T1, class T2>
  31. struct apply : bool_<(T1::value) < (T2::value)> {};
  32. };
  33. }
  34. }
  35. #endif