From ed8a0c3942e37a0dd6de704fc6676384d95ee5b9 Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 16 Oct 2023 09:46:49 -0700 Subject: [PATCH 1/2] Use compiler generated special member functions in host_ptr --- src/care/host_ptr.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/care/host_ptr.h b/src/care/host_ptr.h index e29f1810..ddab3b8b 100644 --- a/src/care/host_ptr.h +++ b/src/care/host_ptr.h @@ -42,14 +42,14 @@ namespace care { /// /// Default constructor /// - host_ptr() noexcept : m_ptr(nullptr) {} + host_ptr() = default; /// /// @author Peter Robinson /// /// nullptr constructor /// - host_ptr(std::nullptr_t) noexcept : m_ptr(nullptr) {} + host_ptr(std::nullptr_t) noexcept : host_ptr() {} /// /// @author Peter Robinson @@ -63,7 +63,7 @@ namespace care { /// /// Copy constructor /// - host_ptr(host_ptr const & ptr) noexcept : m_ptr(ptr.data()) {} + host_ptr(host_ptr const & ptr) = default; /// /// @author Peter Robinson @@ -72,7 +72,7 @@ namespace care { /// template ::value, typename std::enable_if::type = 1> - host_ptr(host_ptr const &ptr) noexcept : m_ptr(ptr.data()) {} + host_ptr(host_ptr const &ptr) noexcept : m_ptr(ptr.m_ptr) {} /// /// @author Peter Robinson @@ -178,7 +178,7 @@ namespace care { } private: - T * m_ptr; //!< Raw host pointer + T* m_ptr = nullptr; //!< Raw host pointer }; /// Comparison operators From 7c2bbb46ad1220cbd104422eac5f99ef5c9549fb Mon Sep 17 00:00:00 2001 From: Alan Dayton Date: Mon, 16 Oct 2023 09:49:28 -0700 Subject: [PATCH 2/2] Use compiler generated special member functions in local_ptr --- src/care/local_ptr.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/care/local_ptr.h b/src/care/local_ptr.h index 84e0d547..b1ff9129 100644 --- a/src/care/local_ptr.h +++ b/src/care/local_ptr.h @@ -37,14 +37,14 @@ namespace care { /// /// Default constructor /// - CARE_HOST_DEVICE local_ptr() noexcept : m_ptr(nullptr) {} + CARE_HOST_DEVICE local_ptr() = default; /// /// @author Alan Dayton /// /// nullptr constructor /// - CARE_HOST_DEVICE local_ptr(std::nullptr_t) noexcept : m_ptr(nullptr) {} + CARE_HOST_DEVICE local_ptr(std::nullptr_t) noexcept : local_ptr() {} /// /// @author Peter Robinson @@ -53,11 +53,12 @@ namespace care { /// CARE_HOST_DEVICE local_ptr(T* ptr) noexcept : m_ptr(ptr) {} + /// /// @author Peter Robinson /// /// Copy constructor /// - CARE_HOST_DEVICE local_ptr(local_ptr const &ptr) noexcept : m_ptr(ptr) {} + CARE_HOST_DEVICE local_ptr(local_ptr const &ptr) = default; /// /// @author Peter Robinson @@ -66,7 +67,7 @@ namespace care { /// template ::value, typename std::enable_if::type = 1> - CARE_HOST_DEVICE local_ptr(local_ptr const &ptr) noexcept : m_ptr(ptr) {} + CARE_HOST_DEVICE local_ptr(local_ptr const &ptr) noexcept : m_ptr(ptr.m_ptr) {} /// /// @author Peter Robinson @@ -134,7 +135,7 @@ namespace care { CARE_HOST_DEVICE const T* cdata() const { return m_ptr; } private: - T * m_ptr; //!< Raw pointer + T* m_ptr = nullptr; //!< Raw pointer }; } // namespace care