#ifndef BOOST_NUMERIC_SAFE_INTEGER_HPP #define BOOST_NUMERIC_SAFE_INTEGER_HPP // MS compatible compilers support #pragma once #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once #endif // Copyright (c) 2012 Robert Ramey // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include "safe_base_operations.hpp" #include "policies.hpp" #include "native.hpp" typedef boost::numeric::policies default_policies; namespace boost { namespace numeric { template< class T, class P = default_policies > struct safe : public safe_base, P>{ BOOST_CONCEPT_ASSERT((Integer)); BOOST_CONCEPT_ASSERT((ExceptionPolicy< typename get_exception_policy

::type >)); typedef safe_base, P > base_type; SAFE_NUMERIC_CONSTEXPR bool validate(const T & t) const { return true; } SAFE_NUMERIC_CONSTEXPR bool validate(T && t) const { return true; } SAFE_NUMERIC_CONSTEXPR safe() : base_type() {} //SAFE_NUMERIC_CONSTEXPR safe(safe && s) : // base_type() //{} template SAFE_NUMERIC_CONSTEXPR safe(const U & u) : base_type(u) {} }; } // numeric } // boost namespace std { ///////////////////////////////////////////////////////////////// // numeric limits for safe etc. template< class T, class P > class numeric_limits< boost::numeric::safe > : public numeric_limits { typedef boost::numeric::safe SI; public: // these expressions are not SAFE_NUMERIC_CONSTEXPR until C++14 so re-implement them here SAFE_NUMERIC_CONSTEXPR static SI min() noexcept { return std::numeric_limits::min(); } SAFE_NUMERIC_CONSTEXPR static SI max() noexcept { return std::numeric_limits::max(); } }; } // std #endif // BOOST_NUMERIC_SAFE_INTEGER_HPP