C++ Logo


Advanced search

Re: [isocpp-lib] std::function

From: Barath Kannan <barathwaj.kannan_at_[hidden]>
Date: Wed, 5 Oct 2022 06:52:56 +1100
On Tue, 4 Oct 2022, 23:18 Jonathan Wakely, <cxx_at_[hidden]> wrote:

> Yes, we'd all like ponies :-)

Yes, and this is effectively what I'm getting at. There is a large list of
requirements that people can have on an erasure abstraction, and that
variations on std::function which offer a subset of these will inevitably
leave some uses cases out.

That is not to say that such an abstraction cannot exist (naios/Function2
has a function_base which comes close) and there are libraries that target
runtime polymorphism more generally (e.g dyno) but standardisation of these
would be a much larger effort and will inevitably lead to problems as more
customisation points are discovered.

Which is why I'm inclined to agree with Arthur that people should just
write their own erasure abstractions (and if possible, the standard should
try to offer tools to make this easier) rather than standardising things
like inplace_function and any_invocable.


Received on 2022-10-04 19:53:07