• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef BOOST_NUMERIC_SAFE_COMMON_HPP
2 #define BOOST_NUMERIC_SAFE_COMMON_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 <type_traits>
11 
12 namespace boost {
13 namespace safe_numerics {
14 
15 // default implementations for required meta-functions
16 template<typename T>
17 struct is_safe : public std::false_type
18 {};
19 
20 template<typename T>
21 struct base_type {
22     using type = T;
23 };
24 
25 template<class T>
base_value(const T & t)26 constexpr const typename base_type<T>::type & base_value(const T & t) {
27     return static_cast<const typename base_type<T>::type & >(t);
28 }
29 
30 template<typename T>
31 struct get_promotion_policy {
32     using type = void;
33 };
34 
35 template<typename T>
36 struct get_exception_policy {
37     using type = void;
38 };
39 
40 
41 } // safe_numerics
42 } // boost
43 
44 #endif // BOOST_NUMERIC_SAFE_COMMON_HPP
45