Passing rvalues through std::bind

后端 未结 5 1623
醉话见心
醉话见心 2020-11-29 06:12

I want to pass an rvalue through std::bind to a function that takes an rvalue reference in C++0x. I can\'t figure out how to do it. For example:



        
5条回答
  •  一整个雨季
    2020-11-29 06:38

    One more improvement in GManNickG's answer and I've got pretty solution:

    auto f = std::bind(
        foo,
        std::bind(std::move, Movable())
    );
    

    (works in gcc-4.9.2 and msvc2013)

提交回复
热议问题