safe_integer.hpp 915 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef BOOST_NUMERIC_SAFE_INTEGER_HPP
  2. #define BOOST_NUMERIC_SAFE_INTEGER_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. // not actually used here - but needed for integer arithmetic
  9. // so this is a good place to include it
  10. #include "checked_integer.hpp"
  11. #include "safe_base.hpp"
  12. #include "safe_base_operations.hpp"
  13. #include "native.hpp"
  14. #include "exception_policies.hpp"
  15. // specialization for meta functions with safe<T> argument
  16. namespace boost {
  17. namespace safe_numerics {
  18. template <
  19. class T,
  20. class P = native,
  21. class E = default_exception_policy
  22. >
  23. using safe = safe_base<
  24. T,
  25. ::std::numeric_limits<T>::min(),
  26. ::std::numeric_limits<T>::max(),
  27. P,
  28. E
  29. >;
  30. } // safe_numerics
  31. } // boost
  32. #endif // BOOST_NUMERIC_SAFE_INTEGER_HPP