]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/safe_numerics/exception_policies.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / safe_numerics / exception_policies.hpp
index 0ee9c2b32f807876276e04fc34b6e20ae8251cf6..5523a9c1c37d67c83a5cde75c49ad20192de0a8a 100644 (file)
@@ -82,7 +82,7 @@ struct throw_exception {
 };
 
 // given an error code - return the action code which it corresponds to.
-constexpr safe_numerics_actions
+constexpr inline safe_numerics_actions
 make_safe_numerics_action(const safe_numerics_error & e){
     // we can't use standard algorithms since we want this to be constexpr
     // this brute force solution is simple and pretty fast anyway
@@ -113,65 +113,6 @@ make_safe_numerics_action(const safe_numerics_error & e){
     return safe_numerics_actions::no_action;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// compile time error dispatcher
-
-// note slightly baroque implementation of a compile time switch statement
-// which instatiates only those cases which are actually invoked.  This is
-// motivated to implement the "trap" functionality which will generate a syntax
-// error if and only a function which might fail is called.
-
-namespace dispatch_switch {
-
-    template<class EP, safe_numerics_actions>
-    struct dispatch_case {};
-
-    template<class EP>
-    struct dispatch_case<EP, safe_numerics_actions::uninitialized_value> {
-        constexpr static void invoke(const safe_numerics_error & e, const char * msg){
-            EP::on_uninitialized_value(e, msg);
-        }
-    };
-    template<class EP>
-    struct dispatch_case<EP, safe_numerics_actions::arithmetic_error> {
-        constexpr static void invoke(const safe_numerics_error & e, const char * msg){
-            EP::on_arithmetic_error(e, msg);
-        }
-    };
-    template<class EP>
-    struct dispatch_case<EP, safe_numerics_actions::implementation_defined_behavior> {
-        constexpr static void invoke(const safe_numerics_error & e, const char * msg){
-            EP::on_implementation_defined_behavior(e, msg);
-        }
-    };
-    template<class EP>
-    struct dispatch_case<EP, safe_numerics_actions::undefined_behavior> {
-        constexpr static void invoke(const safe_numerics_error & e, const char * msg){
-            EP::on_undefined_behavior(e, msg);
-        }
-    };
-
-} // dispatch_switch
-
-template<class EP, safe_numerics_error E>
-constexpr void
-dispatch(const char * msg){
-    constexpr safe_numerics_actions a = make_safe_numerics_action(E);
-    dispatch_switch::dispatch_case<EP, a>::invoke(E, msg);
-}
-
-template<class EP, class R>
-class dispatch_and_return {
-public:
-    template<safe_numerics_error E>
-    constexpr static checked_result<R> invoke(
-        char const * const & msg
-    ) {
-        dispatch<EP, E>(msg);
-        return checked_result<R>(E, msg);
-    }
-};
-
 ////////////////////////////////////////////////////////////////////////////////
 // pre-made error policy classes