numeric.hpp 749 B

1234567891011121314151617181920212223242526272829
  1. #ifndef BOOST_NUMERIC_CONCEPT_NUMERIC_HPP
  2. #define BOOST_NUMERIC_CONCEPT_NUMERIC_HPP
  3. // Copyright (c) 2012 Robert Ramey
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. #include <limits>
  9. namespace boost {
  10. namespace safe_numerics {
  11. template<class T>
  12. struct Numeric {
  13. // if your program traps here, you need to create a
  14. // std::numeric_limits class for your type T. see
  15. // see C++ standard 18.3.2.2
  16. static_assert(
  17. std::numeric_limits<T>::is_specialized,
  18. "std::numeric_limits<T> has not been specialized for this type"
  19. );
  20. };
  21. } // safe_numerics
  22. } // boost
  23. #endif // BOOST_NUMERIC_CONCEPT_NUMERIC_HPP