safe_integer.hpp 956 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 "checked_result_operations.hpp"
  12. #include "safe_base.hpp"
  13. #include "safe_base_operations.hpp"
  14. #include "native.hpp"
  15. #include "exception_policies.hpp"
  16. // specialization for meta functions with safe<T> argument
  17. namespace boost {
  18. namespace safe_numerics {
  19. template <
  20. class T,
  21. class P = native,
  22. class E = default_exception_policy
  23. >
  24. using safe = safe_base<
  25. T,
  26. ::std::numeric_limits<T>::min(),
  27. ::std::numeric_limits<T>::max(),
  28. P,
  29. E
  30. >;
  31. } // safe_numerics
  32. } // boost
  33. #endif // BOOST_NUMERIC_SAFE_INTEGER_HPP