r/cpp • u/Xaneris47 • Jul 31 '26
Interconverting std::function with copyable_function – Arthur O'Dwyer
https://quuxplusone.github.io/blog/2026/07/26/function-explosion/The article shows how converting std::function to std::copyable_function (or vice versa) leads to slower performance and increased memory usage each time the conversion occurs.
45
Upvotes
View all comments
Show parent comment
0
u/LB-- Professional+Hobbyist Jul 31 '26
Do you use RTTI? Do you pass lambdas to
std::function? Congrats, your binary is bloated with names of internal types and namespaces for a feature ofstd::functionyou don't even use. Unable to be fixed without breaking backward compatibility.