Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:59:43

0001 #ifndef BOOST_NUMERIC_SAFE_INTEGER_RANGE_HPP
0002 #define BOOST_NUMERIC_SAFE_INTEGER_RANGE_HPP
0003 
0004 //  Copyright (c) 2012 Robert Ramey
0005 //
0006 // Distributed under the Boost Software License, Version 1.0. (See
0007 // accompanying file LICENSE_1_0.txt or copy at
0008 // http://www.boost.org/LICENSE_1_0.txt)
0009 
0010 #include <cstdint> // intmax_t, uintmax_t
0011 
0012 #include "utility.hpp"
0013 #include "safe_integer.hpp"
0014 #include "native.hpp"
0015 #include "exception_policies.hpp"
0016 
0017 /////////////////////////////////////////////////////////////////
0018 // higher level types implemented in terms of safe_base
0019 
0020 namespace boost {
0021 namespace safe_numerics {
0022 
0023 /////////////////////////////////////////////////////////////////
0024 // safe_signed_range
0025 
0026 template <
0027     std::intmax_t Min,
0028     std::intmax_t Max,
0029     class P = native,
0030     class E = default_exception_policy
0031 >
0032 using safe_signed_range = safe_base<
0033     typename utility::signed_stored_type<Min, Max>,
0034     static_cast<typename utility::signed_stored_type<Min, Max> >(Min),
0035     static_cast<typename utility::signed_stored_type<Min, Max> >(Max),
0036     P,
0037     E
0038 >;
0039 
0040 /////////////////////////////////////////////////////////////////
0041 // safe_unsigned_range
0042 
0043 template <
0044     std::uintmax_t Min,
0045     std::uintmax_t Max,
0046     class P = native,
0047     class E = default_exception_policy
0048 >
0049 using safe_unsigned_range = safe_base<
0050     typename utility::unsigned_stored_type<Min, Max>,
0051     static_cast<typename utility::unsigned_stored_type<Min, Max> >(Min),
0052     static_cast<typename utility::unsigned_stored_type<Min, Max> >(Max),
0053     P,
0054     E
0055 >;
0056 
0057 } // safe_numerics
0058 } // boost
0059 
0060 #endif // BOOST_NUMERIC_SAFE_RANGE_HPP