limits.hpp 986 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2015-2019 Hans Dembinski
  2. //
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt
  5. // or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_HISTOGRAM_DETAIL_LIMITS_HPP
  7. #define BOOST_HISTOGRAM_DETAIL_LIMITS_HPP
  8. #include <limits>
  9. namespace boost {
  10. namespace histogram {
  11. namespace detail {
  12. template <class T>
  13. constexpr T lowest() {
  14. return std::numeric_limits<T>::lowest();
  15. }
  16. template <>
  17. constexpr double lowest() {
  18. return -std::numeric_limits<double>::infinity();
  19. }
  20. template <>
  21. constexpr float lowest() {
  22. return -std::numeric_limits<float>::infinity();
  23. }
  24. template <class T>
  25. constexpr T highest() {
  26. return (std::numeric_limits<T>::max)();
  27. }
  28. template <>
  29. constexpr double highest() {
  30. return std::numeric_limits<double>::infinity();
  31. }
  32. template <>
  33. constexpr float highest() {
  34. return std::numeric_limits<float>::infinity();
  35. }
  36. } // namespace detail
  37. } // namespace histogram
  38. } // namespace boost
  39. #endif