]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/safe_numerics/exception_policies.hpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / boost / safe_numerics / exception_policies.hpp
index e07f7e6f2fbeadc181e15e1eadea06d4cc0aba4f..0ee9c2b32f807876276e04fc34b6e20ae8251cf6 100644 (file)
@@ -21,29 +21,29 @@ template<
     typename UV
 >
 struct exception_policy {
-    static constexpr void on_arithmetic_error(
+    constexpr static void on_arithmetic_error(
         const safe_numerics_error & e,
         const char * msg
     ){
-        AE(e, msg);
+        AE()(e, msg);
     }
-    static constexpr void on_implementation_defined_behavior(
+    constexpr static void on_implementation_defined_behavior(
         const safe_numerics_error & e,
         const char * msg
     ){
-        IDB(e, msg);
+        IDB()(e, msg);
     }
-    static constexpr void on_undefined_behavior(
+    constexpr static void on_undefined_behavior(
         const safe_numerics_error & e,
         const char * msg
     ){
-        UB(e, msg);
+        UB()(e, msg);
     }
-    static constexpr void on_uninitialized_value(
+    constexpr static void on_uninitialized_value(
         const safe_numerics_error & e,
         const char * msg
     ){
-        UV(e, msg);
+        UV()(e, msg);
     }
 };
 
@@ -52,27 +52,32 @@ struct exception_policy {
 
 // ignore any error and just return.
 struct ignore_exception {
-    constexpr ignore_exception(const safe_numerics_error &, const char * ){}
+    constexpr ignore_exception() = default;
+    constexpr void operator () (
+        const boost::safe_numerics::safe_numerics_error &,
+        const char *
+    ){}
 };
 
 // emit compile time error if this is invoked.
 struct trap_exception {
-#if 1
-    //constexpr trap_exception(const safe_numerics_error & e, const char * );
-    trap_exception() = delete;
-    trap_exception(const trap_exception &) = delete;
-    trap_exception(trap_exception &&) = delete;
-#endif
+    constexpr trap_exception() = default;
+    // error will occur on operator call.
+    // hopefully this will display arguments
 };
 
 // If an exceptional condition is detected at runtime throw the exception.
 struct throw_exception {
+    constexpr throw_exception() = default;
     #ifndef BOOST_NO_EXCEPTIONS
-    throw_exception(const safe_numerics_error & e, const char * message){
+    void operator()(
+        const safe_numerics_error & e,
+        const char * message
+    ){
         throw std::system_error(std::error_code(e), message);
     }
     #else
-    trap_exception(const safe_numerics_error & e, const char * message);
+    constexpr trap_exception()(const safe_numerics_error & e, const char * message);
     #endif
 };