diff --git a/include/ktl/containers/packed_ptr.h b/include/ktl/containers/packed_ptr.h index 7abb09f..86f0da5 100644 --- a/include/ktl/containers/packed_ptr.h +++ b/include/ktl/containers/packed_ptr.h @@ -32,11 +32,13 @@ namespace ktl explicit packed_ptr(PtrT p, Int value) noexcept : m_Value((reinterpret_cast(p) & PTR_MASK) | (static_cast(value) & INT_MASK)) { + static_assert(std::is_unsigned_v, "Packed integer must be unsigned"); + // Pointer must be correctly aligned KTL_ASSERT((reinterpret_cast(p) & (Alignment - 1)) == 0); } - operator bool() const noexcept { return m_Value; } + explicit operator bool() const noexcept { return m_Value; } PtrT get_ptr() const noexcept { return reinterpret_cast(m_Value & PTR_MASK); } diff --git a/include/ktl/containers/trivial_vector.h b/include/ktl/containers/trivial_vector.h index d194b60..a3a982a 100644 --- a/include/ktl/containers/trivial_vector.h +++ b/include/ktl/containers/trivial_vector.h @@ -45,7 +45,7 @@ namespace ktl * @brief Construct the vector with the given allocator * @param allocator The allocator to use */ - trivial_vector(const Alloc& allocator) noexcept : + explicit trivial_vector(const Alloc& allocator) noexcept : m_Alloc(allocator), m_Begin(nullptr), m_End(nullptr),