1 #ifndef BOOST_NUMERIC_SAFE_INTEGER_RANGE_HPP
2 #define BOOST_NUMERIC_SAFE_INTEGER_RANGE_HPP
4 // Copyright (c) 2012 Robert Ramey
6 // Distributed under the Boost Software License, Version 1.0. (See
7 // accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
10 #include <cstdint> // intmax_t, uintmax_t
12 #include "utility.hpp"
13 #include "safe_integer.hpp"
15 #include "exception_policies.hpp"
17 /////////////////////////////////////////////////////////////////
18 // higher level types implemented in terms of safe_base
21 namespace safe_numerics {
23 /////////////////////////////////////////////////////////////////
30 class E = default_exception_policy
32 using safe_signed_range = safe_base<
33 typename utility::signed_stored_type<Min, Max>,
34 static_cast<typename utility::signed_stored_type<Min, Max> >(Min),
35 static_cast<typename utility::signed_stored_type<Min, Max> >(Max),
40 /////////////////////////////////////////////////////////////////
41 // safe_unsigned_range
47 class E = default_exception_policy
49 using safe_unsigned_range = safe_base<
50 typename utility::unsigned_stored_type<Min, Max>,
51 static_cast<typename utility::unsigned_stored_type<Min, Max> >(Min),
52 static_cast<typename utility::unsigned_stored_type<Min, Max> >(Max),
60 #endif // BOOST_NUMERIC_SAFE_RANGE_HPP