From 41e040e374c49cfa839a36d5d6b17c158fe6ceb8 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 6 Jun 2023 13:27:29 -0400 Subject: [PATCH] don't use std::pair<> as it's not trivial_copyable --- .../c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/six/modules/c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp b/six/modules/c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp index 9a6154239..7f2ef7bf1 100644 --- a/six/modules/c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp +++ b/six/modules/c++/six.sicd/unittests/test_AMP8I_PHS8I.cpp @@ -233,7 +233,14 @@ static std::vector > read_8bit_ampphs(const std::string& tes return retval; } -static std::pair to_AMP8I_PHS8I(const six::sicd::ImageData& imageData, const std::vector>& widebandData) +template +struct Pair final // std::pair is not trivial copyable +{ + T first; + T second; +}; + +static Pair to_AMP8I_PHS8I(const six::sicd::ImageData& imageData, const std::vector>& widebandData) { // image is far too big to call to_AMP8I_PHS8I() with DEBUG code const auto size = sys::debug ? widebandData.size() / 200 : widebandData.size(); @@ -241,7 +248,7 @@ static std::pair to_AMP8I_PHS8I(const six::sicd::ImageData& std::vector results(widebandData_.size()); imageData.to_AMP8I_PHS8I(widebandData_, std::span< AMP8I_PHS8I_t>(results.data(), results.size()), 0); - std::pair retval(0, 0); + Pair retval{ 0, 0 }; for (const auto& r : results) { retval.first += r.first; @@ -272,7 +279,7 @@ TEST_CASE(read_8bit_ampphs_with_table) imageData.amplitudeTable.reset(std::make_unique< six::AmplitudeTable>(AmpTable)); const auto actual = to_AMP8I_PHS8I(imageData, widebandData); const auto expected(sys::debug ? - std::pair(12647523, 16973148) : std::pair(3044868397, 3394353166)); + Pair{12647523, 16973148} : Pair{ 3044868397, 3394353166 }); //TEST_ASSERT_EQ(actual.first, expected.first); // TODO TEST_ASSERT_EQ(actual.second, expected.second); } @@ -291,7 +298,7 @@ TEST_CASE(read_8bit_ampphs_no_table) six::sicd::ImageData imageData; const auto actual = to_AMP8I_PHS8I(imageData, widebandData); const auto expected(sys::debug ? - std::pair(12647654, 16973148) : std::pair(3044873160, 3394353122)); + Pair{12647654, 16973148} : Pair{ 3044873160, 3394353122 }); TEST_ASSERT_EQ(actual.first, expected.first); TEST_ASSERT_EQ(actual.second, expected.second); }