C++ Logo

sg14

Advanced search

Re: [isocpp-lib] std::function

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Tue, 20 Sep 2022 12:19:13 -0400
On Tue, Sep 20, 2022 at 9:22 AM Bjarne Stroustrup via Lib <
lib_at_[hidden]> wrote:

> I thought we had a variant of std::function that didn't allocate on free
> store for simple functions; it didn't make it for C++20? Is it still in
> process? and if so where would I look for the current state of the
> proposal.
>

[cc: SG14]
SG14 has implemented, and I maintain, a type-erased
`stdext::inplace_function<void(), Capacity, Align>` based on an informal
proposal by Carl Cook in 2016:
https://github.com/WG21-SG14/SG14/blob/master/SG14/inplace_function.h
https://github.com/Quuxplusone/SG14/blob/ajo/include/sg14/inplace_function.h
https://groups.google.com/a/isocpp.org/g/std-proposals/c/vven2Om7Ha8/m/C7qQ_XwVCwAJ
https://github.com/WG21-SG14/SG14/blob/master/Docs/Proposals/NonAllocatingStandardFunction.pdf

It has never had a P-numbered proposal, and the area hasn't seen any
movement that I'm aware of since circa 2018.

https://github.com/WG21-SG14/SG14/issues/125 inspired the implicit-move
changes in C++20 (P1155 More Implicit Move).
https://github.com/WG21-SG14/SG14/issues/150 is still an important
practical issue, where I happen to believe that the STL has chosen the
wrong default as usual, and why I stopped caring much about the
introduction of new type-erased types into the STL and started evangelizing
type erasure *as a technique* so that people can just write their own.
https://quuxplusone.github.io/blog/2019/03/27/design-space-for-std-function/
is related.

HTH,
Arthur

Received on 2022-09-20 16:19:27