]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/safe_numerics/safe_integer_range.hpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / boost / safe_numerics / safe_integer_range.hpp
1 #ifndef BOOST_NUMERIC_SAFE_INTEGER_RANGE_HPP
2 #define BOOST_NUMERIC_SAFE_INTEGER_RANGE_HPP
3
4 // Copyright (c) 2012 Robert Ramey
5 //
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)
9
10 #include <cstdint> // intmax_t, uintmax_t
11
12 #include "utility.hpp"
13 #include "safe_integer.hpp"
14 #include "native.hpp"
15 #include "exception_policies.hpp"
16
17 /////////////////////////////////////////////////////////////////
18 // higher level types implemented in terms of safe_base
19
20 namespace boost {
21 namespace safe_numerics {
22
23 /////////////////////////////////////////////////////////////////
24 // safe_signed_range
25
26 template <
27 std::intmax_t Min,
28 std::intmax_t Max,
29 class P = native,
30 class E = default_exception_policy
31 >
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),
36 P,
37 E
38 >;
39
40 /////////////////////////////////////////////////////////////////
41 // safe_unsigned_range
42
43 template <
44 std::uintmax_t Min,
45 std::uintmax_t Max,
46 class P = native,
47 class E = default_exception_policy
48 >
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),
53 P,
54 E
55 >;
56
57 } // safe_numerics
58 } // boost
59
60 #endif // BOOST_NUMERIC_SAFE_RANGE_HPP