From 3dfdafccd7d24187ddd4967f99f5d5ef46110211 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 6 Aug 2023 12:09:36 +0100 Subject: any_ptr accepts refs and forward refs --- slicer/slicer/any_ptr.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/slicer/slicer/any_ptr.h b/slicer/slicer/any_ptr.h index 34f8529..14199c0 100644 --- a/slicer/slicer/any_ptr.h +++ b/slicer/slicer/any_ptr.h @@ -9,6 +9,14 @@ namespace Slicer { // NOLINTNEXTLINE(hicpp-explicit-conversions) inline constexpr any_ptr(T * p) noexcept : ptr {p} { } + // cppcheck-suppress noExplicitConstructor + // NOLINTNEXTLINE(hicpp-explicit-conversions) + inline constexpr any_ptr(T & p) noexcept : ptr {&p} { } + + // cppcheck-suppress noExplicitConstructor + // NOLINTNEXTLINE(hicpp-explicit-conversions) + inline constexpr any_ptr(T && p) noexcept : ptr {&p} { } + template requires requires(S p) { p.get(); } // cppcheck-suppress noExplicitConstructor -- cgit v1.2.3