Skip to content

Commit 2d4c687

Browse files
Abseil Teamcopybara-github
authored andcommitted
std::shared_ptr<T>::unique() is deprecated in C++17 and removed in C++20.
Change to checking for use_count() >/== 1. PiperOrigin-RevId: 510125744 Change-Id: I572cca18c3f827f5d3eefb2ec19a1a014c0090ae
1 parent b540445 commit 2d4c687

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

absl/functional/any_invocable_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,14 +1431,14 @@ TYPED_TEST_P(AnyInvTestRvalue, QualifierIndependentObjectLifetime) {
14311431
auto refs = std::make_shared<std::nullptr_t>();
14321432
{
14331433
AnyInvType fun([refs](auto&&...) noexcept { return 0; });
1434-
EXPECT_FALSE(refs.unique());
1434+
EXPECT_GT(refs.use_count(), 1);
14351435

14361436
std::move(fun)(7, 8, 9);
14371437

14381438
// Ensure destructor hasn't run even if rref-qualified
1439-
EXPECT_FALSE(refs.unique());
1439+
EXPECT_GT(refs.use_count(), 1);
14401440
}
1441-
EXPECT_TRUE(refs.unique());
1441+
EXPECT_EQ(refs.use_count(), 1);
14421442
}
14431443

14441444
// NOTE: This test suite originally attempted to enumerate all possible

0 commit comments

Comments
 (0)