another case where this would be useful https://github.com/kelbon/AnyAny ))

ср, 27 июл. 2022 г. в 22:40, Emile Cormier via Std-Proposals <std-proposals@lists.isocpp.org>:
(Cross-posted to https://github.com/chriskohlhoff/asio/issues/1100)

In the upcoming C++ networking proposal, we need a wrapper that type-erases an asynchronous handler and bundles its associated executor and allocator. This would prevent the forcing of higher-level networking libraries to be header-only. It would also allow such higher-level networking libraries to expose known types in its API, instead of templatized function arguments.

This proposed type-erased handler could be passed to asio::post and the like. It would also have to support underlying handlers that are move-only.

Some of us still care about compile times and being able to apply the Pimpl idiom. This is not possible when our libraries are forced to be header-only because of Asio wanting everything to be a template.

I have found such a wrapper in the wild at https://github.com/inetic/asio-utp/blob/master/include/asio_utp/detail/handler.hpp . However it lacks small buffer optimization and has additional stuff that seems specific to that library.

Cheers,
Emile Cormier
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals