diff --git a/miosix/e20/callback.h b/miosix/e20/callback.h index 5993d54e3222af05b474e3ee93e4de74904ab62d..9d24583bc454a11def47c6f5770df884dc474265 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 a0690a3077a9a93d88f01985b69ef01d75d6c023..aac4476e7966cdc224c360c9ad8d661f91afc6b0 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; } /**