Re: std::packaged_task trunk problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7 November 2011 09:26, Lars Gullik Bjønnes wrote:
>
> This is the wrapper I ended up with. I had to remove the throw, it
> triggered all the time.

What if you give PretendToBeCopyable a noexcept destructor?
That should ensure the container will move it rather than copy it,
whenever possible.

> template<typename Moveable>
> struct PretendToBeCopyable
> {
>        explicit PretendToBeCopyable(Moveable&& m) : m(std::move(m)) {}
>        PretendToBeCopyable(PretendToBeCopyable&&) = default;
>        PretendToBeCopyable(PretendToBeCopyable& p)
>                : m(std::move(p.m)) {}
>        void operator()() { m(); }

          ~PretendToBeCopyable() noexcept = default;

> private:
>        Moveable m;
> };
>
> }



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux