From eb872cdf8832ecaab38271d5168c17249a487da9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Aug 2019 02:10:49 -0400 Subject: [PATCH] hecl/hecl: Assign ResourceLock's good member in the initializer list Same behavior, but more idiomatic. While we're at it, we can make said constructor and the conversion operator explicit to make the class a little less error-prone. --- hecl/include/hecl/hecl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index 44b306a03..7ab9fd591 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -1110,9 +1110,9 @@ class ResourceLock { bool good; public: - operator bool() const { return good; } + explicit operator bool() const { return good; } static bool InProgress(const ProjectPath& path); - ResourceLock(const ProjectPath& path) { good = SetThreadRes(path); } + explicit ResourceLock(const ProjectPath& path) : good{SetThreadRes(path)} {} ~ResourceLock() { if (good) ClearThreadRes();