Skip to content

Commit

Permalink
Fixed issue with temporary.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimi1010 committed Aug 15, 2024
1 parent f1baa83 commit 6b50130
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Tests/Common++Test/Tests/PointerVectorTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6b50130

Please sign in to comment.