C++ Logo

std-discussion

Advanced search

Re: Addressability of the standard template function std::invoke.

From: Daniel Krügler <daniel.kruegler_at_[hidden]>
Date: Sat, 28 Oct 2023 19:30:54 +0200
Am Sa., 28. Okt. 2023 um 19:12 Uhr schrieb Vladimir Grigoriev via
Std-Discussion <std-discussion_at_[hidden]>:
>
> I read ( en.cppreference.com/w/cpp/language/) that standard functions are not addressable except some limited number of functions. Otherwise the behavior either undefined or unspecified.
>
> May the function std::invoke be used as shown below?

No. Basically only IO manipulator functions are addressable functions
in the Standard Library.

> std::for_each( std::begin( v ), std::end( v ), std::invoke<std::function<void()> &> );

Why not using a lambda expression instead?

- Daniel

Received on 2023-10-28 17:31:07