From e3df05b15a24682fcff2b1e5c149678c3501d98a Mon Sep 17 00:00:00 2001
From: KRM7 <70973547+KRM7@users.noreply.github.com>
Date: Wed, 7 Feb 2024 19:46:32 +0100
Subject: [PATCH] add static_assert for completeness (closes #2)
---
src/small_unique_ptr.hpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/small_unique_ptr.hpp b/src/small_unique_ptr.hpp
index b4c3d5e..079f1c7 100644
--- a/src/small_unique_ptr.hpp
+++ b/src/small_unique_ptr.hpp
@@ -55,6 +55,16 @@ namespace detail
inline constexpr bool is_proper_base_of_v = is_proper_base_of::value;
+ template
+ struct is_complete : std::false_type {};
+
+ template
+ struct is_complete> {};
+
+ template
+ inline constexpr bool is_complete_v = is_complete::value;
+
+
inline constexpr std::size_t small_ptr_size = 64;
@@ -203,7 +213,7 @@ template
class small_unique_ptr : private detail::small_unique_ptr_base
{
public:
- static_assert(!std::is_array_v && !std::is_void_v);
+ static_assert(detail::is_complete_v && !std::is_array_v);
using element_type = T;
using pointer = T*;