diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-08-06 12:09:36 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-08-06 12:09:36 +0100 |
commit | 3dfdafccd7d24187ddd4967f99f5d5ef46110211 (patch) | |
tree | 20b212c88cc782de0194475bb17d33ec024cf82a | |
parent | Replace lots of shared_ptr with unique_ptr or any_ptr (diff) | |
download | slicer-3dfdafccd7d24187ddd4967f99f5d5ef46110211.tar.bz2 slicer-3dfdafccd7d24187ddd4967f99f5d5ef46110211.tar.xz slicer-3dfdafccd7d24187ddd4967f99f5d5ef46110211.zip |
any_ptr accepts refs and forward refs
-rw-r--r-- | slicer/slicer/any_ptr.h | 8 |
1 files changed, 8 insertions, 0 deletions
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<typename S> requires requires(S p) { p.get(); } // cppcheck-suppress noExplicitConstructor |