Boost logo

Boost :

From: Julien Blanc (julien.blanc_at_[hidden])
Date: 2023-12-05 15:05:04


Le 2023-12-05 12:24, Andrey Semashev via Boost a écrit :
> On 12/5/23 12:17, Julien Blanc wrote:
>> Le 2023-12-01 15:42, Andrey Semashev via Boost a écrit :

> Requiring function objects to be trivially copyable is definitely going
> too far, as it prohibits binding most objects by value, even if such
> binding would not throw. For example, you wouldn't be able to bind
> smart-pointers, std::string or std::optional.

That's true, but i would be curious about what's the occurrence of such
cases in actual code. shared_ptrs (or anything refcounted) are the most
obvious candidates. string looks like a misuse for me (i would not rely
on sso). optional is trivially_copyable if the underlying type is,
otherwise cf string. I'm curious about how much breakage adding such an
assert causes in actual code, and which percentage of these breakage is
actually a valid concern (ie, there was a potential problem that this
assert detected). I guess the signal/noise ratio should either proves me
completly wrong, or make a point for two distinct guards.

Regards,

Julien


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk