From 94e242f2fdc37eb670fc8c73147992a14e9de0ec Mon Sep 17 00:00:00 2001 From: Johanna Amann Date: Mon, 27 Jun 2016 12:09:31 -0700 Subject: [PATCH] Input/Logging: Make operator explicit This fixes a long-standing todo for once we switch to C++11. --- src/input/Tag.h | 5 +---- src/logging/Tag.h | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/input/Tag.h b/src/input/Tag.h index c9e997f8e9..78dd65676f 100644 --- a/src/input/Tag.h +++ b/src/input/Tag.h @@ -42,11 +42,8 @@ public: /** * Returns false if the tag represents an error value rather than a * legal reader type. - * TODO: make this conversion operator "explicit" (C++11) or use a - * "safe bool" idiom (not necessary if "explicit" is available), - * otherwise this may allow nonsense/undesired comparison operations. */ - operator bool() const { return *this != Tag(); } + explicit operator bool() const { return *this != Tag(); } /** * Assignment operator. diff --git a/src/logging/Tag.h b/src/logging/Tag.h index ae75487664..bcb7af946b 100644 --- a/src/logging/Tag.h +++ b/src/logging/Tag.h @@ -42,11 +42,8 @@ public: /** * Returns false if the tag represents an error value rather than a * legal writer type. - * TODO: make this conversion operator "explicit" (C++11) or use a - * "safe bool" idiom (not necessary if "explicit" is available), - * otherwise this may allow nonsense/undesired comparison operations. */ - operator bool() const { return *this != Tag(); } + explicit operator bool() const { return *this != Tag(); } /** * Assignment operator.