1 #ifndef BOOST_NUMERIC_CONCEPT_SAFE_NUMERIC_HPP 2 #define BOOST_NUMERIC_CONCEPT_SAFE_NUMERIC_HPP 3 4 // Copyright (c) 2015 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 <limits> 11 #include <typetraits> 12 #include <boost/concept/usage.hpp> 13 #include "concept/numeric.hpp" 14 15 namespace boost { 16 namespace safe_numerics { 17 18 template<class T> 19 struct SafeNumeric : public Numeric<T> { 20 static_assert( 21 is_safe<T>::value, 22 "std::numeric_limits<T> has not been specialized for this type" 23 ); BOOST_CONCEPT_USAGEboost::safe_numerics::SafeNumeric24 BOOST_CONCEPT_USAGE(SafeNumeric){ 25 using t1 = get_exception_policy<T>; 26 using t2 = get_promotion_policy<T>; 27 using t3 = base_type<T>; 28 } 29 }; 30 31 } // safe_numerics 32 } // boost 33 34 #endif // BOOST_NUMERIC_CONCEPT_SAFE_NUMERIC_HPP 35