From 5fb587a7c4b462b82aedb6ad2e7bb25dfa71fa8f Mon Sep 17 00:00:00 2001
From: Terraneo Federico <fede.tft@miosix.org>
Date: Wed, 29 Mar 2023 10:06:06 +0200
Subject: [PATCH] Remove pre-C++11 code

---
 miosix/e20/callback.h     | 8 ++------
 miosix/kernel/intrusive.h | 8 ++------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/miosix/e20/callback.h b/miosix/e20/callback.h
index 5993d54e..9d24583b 100644
--- a/miosix/e20/callback.h
+++ b/miosix/e20/callback.h
@@ -175,17 +175,13 @@ public:
     {
         operation(any,0,CALL);
     }
-
-    //Safe bool idiom
-    struct SafeBoolStruct { void* b; };
-    typedef void* SafeBoolStruct::* SafeBool;
     
     /**
      * \return true if the object contains a callback
      */
-    operator SafeBool() const
+    explicit operator bool() const
     {
-        return operation==0 ? 0 : &SafeBoolStruct::b;
+        return operation!=nullptr;
     }
 
     /**
diff --git a/miosix/kernel/intrusive.h b/miosix/kernel/intrusive.h
index a0690a30..aac4476e 100755
--- a/miosix/kernel/intrusive.h
+++ b/miosix/kernel/intrusive.h
@@ -269,17 +269,13 @@ public:
      * \return a pointer to the managed object
      */
     T *operator->() const { return object; }
-    
-    //Safe bool idiom
-    struct SafeBoolStruct { void* b; };
-    typedef void* SafeBoolStruct::* SafeBool;
 
     /**
      * \return true if the object contains a callback
      */
-    operator SafeBool() const
+    explicit operator bool() const
     {
-        return object==0 ? 0 : &SafeBoolStruct::b;
+        return object!=nullptr;
     }
     
     /**
-- 
GitLab