std::packaged_task trunk problem

Jonathan Wakely
Mon Nov 7 10:48:00 GMT 2011

On 7 November 2011 10:46, Lars Gullik Bjønnes wrote:
> Yes it compiles. The copy constructor is still run, but if having that
> throw I still get into std::terminate.

The reason the copy constructor does still get called is because
std::function doesn't have a noexcept move constructor, so resizing
the vector will copy the function (which copies its target
PretendToBeCopyable) instead of moving it.

I hadn't realised how hard it is to make this work with the final
C++11 rules :-\

More information about the Gcc-help mailing list