|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2023-01-09 18:15:55
Hans Dembinski wrote:
...
> With delayed_forward one can efficiently pass values to Foo with a single ctor.
> The trade-off is a tiny runtime cost, but thatâs ok if we know that Foos are not
> created en mass in a hot loop. That already guided my choice of passing by
> value.
>
> A minimal demo is here:
> https://godbolt.org/z/z71E1jno1
It will be better if you show how the existing code (before the delayed_forward
transformation) looks like.
You could also point to the actual code in Histogram for those who would like
even more context.
If I understand correctly, the lack of strong guarantee is caused by the by-value
constructor moving from the argument even when construction fails? E.g.
Foo foo( true, std::move( my_t ) );
// leaves my_t moved-from on exception
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk