Skip to content

Commit 79bdce3

Browse files
committed
Port static asserts to the main pointer classes
1 parent 0d142ac commit 79bdce3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

include/oup/observable_unique_ptr.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,8 @@ constexpr bool has_enable_observer_from_this =
353353
template<typename T, typename Deleter, typename Policy>
354354
class basic_observable_ptr final {
355355
public:
356-
static_assert(!std::is_array_v<T>, "T[] is not supported");
356+
static_assert(!std::is_reference_v<T>, "cannot create a pointer to a reference");
357+
static_assert(!std::is_array_v<T>, "cannot create a pointer to an array");
357358

358359
/// Policy for this smart pointer
359360
using policy = Policy;
@@ -920,7 +921,8 @@ bool operator!=(
920921
template<typename T, typename Policy>
921922
class basic_observer_ptr final {
922923
public:
923-
static_assert(!std::is_array_v<T>, "T[] is not supported");
924+
static_assert(!std::is_reference_v<T>, "cannot create a pointer to a reference");
925+
static_assert(!std::is_array_v<T>, "cannot create a pointer to an array");
924926

925927
/// Policy for the control block
926928
using observer_policy = Policy;

0 commit comments

Comments
 (0)