Set up inlining for InvokeWithoutArgs when passed a functor.

Actions can now be implicitly constructed from zero-argument callables. There is no need to create wrapper objects using InvokeWithoutArgs().

PiperOrigin-RevId: 949656497
Change-Id: Ida2bc38e446e7b33aaf185ec593caf2a1959138e
This commit is contained in:
Abseil Team
2026-07-17 10:58:22 -07:00
committed by Copybara-Service
parent 4141c384aa
commit fa005b296f
3 changed files with 10 additions and 25 deletions
+2 -3
View File
@@ -1026,9 +1026,8 @@ TEST(DoAllTest, NoArgs) {
TEST(DoAllTest, MoveOnlyArgs) {
bool ran_first = false;
Action<int(std::unique_ptr<int>)> a =
DoAll(InvokeWithoutArgs([&] { ran_first = true; }),
[](std::unique_ptr<int> p) { return *p; });
Action<int(std::unique_ptr<int>)> a = DoAll(
[&] { ran_first = true; }, [](std::unique_ptr<int> p) { return *p; });
EXPECT_EQ(7, a.Perform(std::make_tuple(std::unique_ptr<int>(new int(7)))));
EXPECT_TRUE(ran_first);
}