From 9aff2101c1504b425d8da190d1a24700a493190d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Haitz=20Legarreta=20Gorro=C3=B1o?= Date: Mon, 29 Apr 2024 18:34:19 -0400 Subject: [PATCH] COMP: Use `default` copy, move for construc, assign `RealTimeStamp` Use the compiler-proved default implementations for `itk::RealTimeStamp` copy constructor, copy assignment, move constructor, and move assignment functions. As noted in [1], the C++ standard deprecated the implicit generation of copy and assignment operators. Fixes: ``` [CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkRealTimeStamp.h:56:3: warning: definition of implicit copy assignment operator for 'RealTimeStamp' is deprecated because it has a user-declared destructor [-Wdeprecated] ~RealTimeStamp(); ^ [CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkDataObject.h:452:3: note: in implicit copy assignment operator for 'itk::RealTimeStamp' first required here itkSetMacro(RealTimeStamp, RealTimeStamp); ^ [CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:992:22: note: expanded from macro 'itkSetMacro' this->m_##name = std::move(_arg); \ ^ [CTest: warning suppressed] 1 warning generated. ``` And other similar warnings stemming from `itk::RealTimeStamp` that have been appearing consistently in some macOS site builds in the dashboard: https://open.cdash.org/viewBuildError.php?type=1&buildid=9579479 [1] https://learn.microsoft.com/bs-latn-ba/cpp/error-messages/compiler-warnings/c5267?view=msvc-150#remarks --- Modules/Core/Common/include/itkRealTimeStamp.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Modules/Core/Common/include/itkRealTimeStamp.h b/Modules/Core/Common/include/itkRealTimeStamp.h index 91d74c93ac2..3f69046ab02 100644 --- a/Modules/Core/Common/include/itkRealTimeStamp.h +++ b/Modules/Core/Common/include/itkRealTimeStamp.h @@ -55,6 +55,13 @@ class ITKCommon_EXPORT RealTimeStamp /** Destructor */ ~RealTimeStamp(); + RealTimeStamp(const RealTimeStamp &) = default; + RealTimeStamp & + operator=(const RealTimeStamp &) = default; + RealTimeStamp(RealTimeStamp &&) = default; + RealTimeStamp & + operator=(RealTimeStamp &&) = default; + /** Native type used to represent the time in different time units. */ using TimeRepresentationType = RealTimeInterval::TimeRepresentationType;