From 6b501302bdfc2292a233b7c424fcbb3a29003aaa Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Thu, 15 Aug 2024 14:00:13 +0300 Subject: [PATCH] Fixed issue with temporary. --- Tests/Common++Test/Tests/PointerVectorTests.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Tests/Common++Test/Tests/PointerVectorTests.cpp b/Tests/Common++Test/Tests/PointerVectorTests.cpp index b6c89a5f19..edba7d4b16 100644 --- a/Tests/Common++Test/Tests/PointerVectorTests.cpp +++ b/Tests/Common++Test/Tests/PointerVectorTests.cpp @@ -94,7 +94,10 @@ namespace pcpp EXPECT_EQ(pVector.size(), 2); { - int* removed = pVector.getAndRemoveFromVector(pVector.begin()); + // Can't pass pVector.begin() directly to getAndRemoveFromVector because temporaries can't be passed as + // non-const reference. + auto it = pVector.begin(); + int* removed = pVector.getAndRemoveFromVector(it); EXPECT_EQ(*removed, 1); EXPECT_EQ(pVector.size(), 1); EXPECT_EQ(*pVector.front(), 3);