[vlc-commits] vlc_shared_data_ptr: make operator bool() explicit

Romain Vimont git at videolan.org
Fri Nov 23 16:46:13 CET 2018


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Tue Nov 20 15:26:43 2018 +0100| [bd319b917248e243c23dc177541aa32cb6ee42c4] | committer: Thomas Guillem

vlc_shared_data_ptr: make operator bool() explicit

Like unique_ptr, make the operator bool() explicit, so that it is only
called implicitly when the value may be "contextually converted to bool"
(if, while, etc.).

Suggested-by: Filip Roséen <filip at atch.se>
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bd319b917248e243c23dc177541aa32cb6ee42c4
---

 include/vlc_cxx_helpers.hpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/vlc_cxx_helpers.hpp b/include/vlc_cxx_helpers.hpp
index ed807977b1..5050d1ddb0 100644
--- a/include/vlc_cxx_helpers.hpp
+++ b/include/vlc_cxx_helpers.hpp
@@ -207,7 +207,7 @@ public:
         return !(*this == other);
     }
 
-    operator bool() const
+    explicit operator bool() const
     {
         return ptr;
     }



More information about the vlc-commits mailing list