From cf5738eb3a7ec8f39038432fe2cd17d1354eb877 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=A8=E5=A4=B4=E4=BA=91?= Date: Sun, 30 Nov 2025 11:16:03 +0000 Subject: [PATCH] fix(test): replace C++17 structured bindings with C++14 compatible code Problem: - Two test cases in test_buffer.cpp used structured bindings (auto [a, b]) - Structured bindings are a C++17 feature - Project requires C++14 compatibility Solution: - Replace 'auto [ptr, size] = buf.to_tuple()' with C++14 compatible code - Use std::get() to extract tuple elements - Modified tests: ToTupleNonConst, ToTupleConst Changes: - Line 239: Use std::get<0/1>(tuple) instead of structured binding - Line 252: Use std::get<0/1>(tuple) instead of structured binding - Add explanatory comments for clarity This ensures the test suite compiles with C++14 standard. --- test/test_buffer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/test_buffer.cpp b/test/test_buffer.cpp index b309b35..334395b 100644 --- a/test/test_buffer.cpp +++ b/test/test_buffer.cpp @@ -236,7 +236,10 @@ TEST_F(BufferTest, ToTupleNonConst) { buffer buf(data, 25, DestructorTracker::destructor); - auto [ptr, size] = buf.to_tuple(); + // C++14 compatible: use std::get instead of structured binding + auto tuple = buf.to_tuple(); + auto ptr = std::get<0>(tuple); + auto size = std::get<1>(tuple); EXPECT_EQ(ptr, buf.data()); EXPECT_EQ(size, buf.size()); EXPECT_EQ(size, 25u); @@ -249,7 +252,10 @@ TEST_F(BufferTest, ToTupleConst) { const buffer buf(data, 30, DestructorTracker::destructor); - auto [ptr, size] = buf.to_tuple(); + // C++14 compatible: use std::get instead of structured binding + auto tuple = buf.to_tuple(); + auto ptr = std::get<0>(tuple); + auto size = std::get<1>(tuple); EXPECT_EQ(ptr, buf.data()); EXPECT_EQ(size, buf.size()); EXPECT_EQ(size, 30u);