Visual Studio 2013 C++ - Passing std::unique_ptr to a bound function

前端 未结 3 1758
走了就别回头了
走了就别回头了 2020-12-21 03:53

Using Visual Studio 2013 RC and C++, I\'m trying to pass an std::unique_ptr to a function that has been bound using std::bind. However, I\'m having

3条回答
  •  孤城傲影
    2020-12-21 04:22

    Functions bound with std::bind do not forward arguments, it copies them to the function. As a result, std::bind doesn't work with move-only types as of c++11. This problem is the idea behind proposals for "more perfect forwarding" (like this one). There's a newer one, but I can't seem to find it right now.

提交回复
热议问题