diff --git a/hecl/include/hecl/BitVector.hpp b/hecl/include/hecl/BitVector.hpp index acd1916fc..3944b6512 100644 --- a/hecl/include/hecl/BitVector.hpp +++ b/hecl/include/hecl/BitVector.hpp @@ -67,7 +67,7 @@ public: return *this; } - operator bool() const { return ((*WordRef) & (BitWord(1) << BitPos)) != 0; } + explicit operator bool() const { return ((*WordRef) & (BitWord(1) << BitPos)) != 0; } }; /// BitVector default ctor - Creates an empty bitvector. diff --git a/hecl/include/hecl/Blender/SDNARead.hpp b/hecl/include/hecl/Blender/SDNARead.hpp index 9a8e2b823..55334223c 100644 --- a/hecl/include/hecl/Blender/SDNARead.hpp +++ b/hecl/include/hecl/Blender/SDNARead.hpp @@ -57,7 +57,7 @@ class SDNARead { public: explicit SDNARead(SystemStringView path); - operator bool() const { return !m_data.empty(); } + explicit operator bool() const { return !m_data.empty(); } const SDNABlock& sdnaBlock() const { return m_sdnaBlock; } void enumerate(const std::function& func) const; }; diff --git a/hecl/include/hecl/Database.hpp b/hecl/include/hecl/Database.hpp index e125c1b1b..2b70e4b0a 100644 --- a/hecl/include/hecl/Database.hpp +++ b/hecl/include/hecl/Database.hpp @@ -246,7 +246,7 @@ private: public: Project(const ProjectRootPath& rootPath); - operator bool() const { return m_valid; } + explicit operator bool() const { return m_valid; } /** * @brief Configuration file handle diff --git a/hecl/include/hecl/TypedVariant.hpp b/hecl/include/hecl/TypedVariant.hpp index 1ed924a94..1842b9dfc 100644 --- a/hecl/include/hecl/TypedVariant.hpp +++ b/hecl/include/hecl/TypedVariant.hpp @@ -173,7 +173,7 @@ public: }, static_cast(*this)); } - constexpr operator bool() const noexcept { + constexpr explicit operator bool() const noexcept { return !std::holds_alternative>>(*this); } }; diff --git a/hecl/include/hecl/UniformBufferPool.hpp b/hecl/include/hecl/UniformBufferPool.hpp index b9ceb115d..61c6dea09 100644 --- a/hecl/include/hecl/UniformBufferPool.hpp +++ b/hecl/include/hecl/UniformBufferPool.hpp @@ -153,7 +153,7 @@ public: return {bucket.buffer, m_div.rem * m_pool->m_stride}; } - operator bool() const { return m_pool != nullptr && m_index != -1; } + explicit operator bool() const { return m_pool != nullptr && m_index != -1; } }; UniformBufferPool() = default; diff --git a/hecl/include/hecl/VertexBufferPool.hpp b/hecl/include/hecl/VertexBufferPool.hpp index 4468e5ef2..feb8e6ec0 100644 --- a/hecl/include/hecl/VertexBufferPool.hpp +++ b/hecl/include/hecl/VertexBufferPool.hpp @@ -158,7 +158,7 @@ public: return {bucket.buffer, m_div.rem}; } - operator bool() const { return m_pool != nullptr && m_index != -1; } + explicit operator bool() const { return m_pool != nullptr && m_index != -1; } }; VertexBufferPool() = default; diff --git a/hecl/include/hecl/hecl.hpp b/hecl/include/hecl/hecl.hpp index f3e9fdb58..4ab571852 100644 --- a/hecl/include/hecl/hecl.hpp +++ b/hecl/include/hecl/hecl.hpp @@ -525,7 +525,7 @@ public: DirectoryEnumerator(SystemStringView path, Mode mode = Mode::DirsThenFilesSorted, bool sizeSort = false, bool reverse = false, bool noHidden = false); - operator bool() const { return m_entries.size() != 0; } + explicit operator bool() const { return m_entries.size() != 0; } size_t size() const { return m_entries.size(); } std::vector::const_iterator begin() const { return m_entries.cbegin(); } std::vector::const_iterator end() const { return m_entries.cend(); } @@ -557,7 +557,7 @@ public: /** * @brief Tests for non-empty project root path */ - operator bool() const { return m_projRoot.size() != 0; } + explicit operator bool() const { return m_projRoot.size() != 0; } /** * @brief Construct a representation of a project root path @@ -677,7 +677,7 @@ public: /** * @brief Tests for non-empty project path */ - operator bool() const { return m_absPath.size() != 0; } + explicit operator bool() const { return m_absPath.size() != 0; } /** * @brief Clears path diff --git a/hecl/lib/Pipeline.cpp b/hecl/lib/Pipeline.cpp index b458599b0..7f2aed739 100644 --- a/hecl/lib/Pipeline.cpp +++ b/hecl/lib/Pipeline.cpp @@ -25,7 +25,7 @@ public: inflateInit(&m_zstrm); } ~ShaderCacheZipStream() override { inflateEnd(&m_zstrm); } - operator bool() const { return m_compBuf.operator bool(); } + explicit operator bool() const { return m_compBuf.operator bool(); } atUint64 readUBytesToBuf(void* buf, atUint64 len) override { m_zstrm.next_out = (Bytef*)buf; m_zstrm.avail_out = len;