Boost logo

Boost :

From: Alexander Grund (alexander.grund_at_[hidden])
Date: 2019-06-27 06:11:31


Am 27.06.19 um 04:03 schrieb David Sankel via Boost:
> On Wed, Apr 17, 2019 at 8:42 AM Andrzej Krzemienski via Boost <
> boost_at_[hidden]> wrote:
>
>> wt., 16 kwi 2019 o 23:57 Richard Hodges via Boost <boost_at_[hidden]>
>> napisał(a):
>>
>>> Are there real-world examples of well-designed classes who's move
>>> assignment operators throw?
>>>
>>> I think if I saw that in a code review I'd be inclined to demand a
>>> different design choice.
>>>
>>> Is there a good reason that variants should support such classes?
>>>
>> Some implementations of std::list throw from their move constructors and
>> default constructors. I understand that the implementation is easier if
>> even an empty list has a dummy node, which requires allocation.
>>
> Also classes that use the PIMPL idiom.

If a class uses PIMPL and does a move, isn't that just a pointer swap
which cannot throw? Or would that be implemented as another allocation
in the moved-from class? I can't imagine why.




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