Why can't a move a noncopyable functor to a std::function?

The short answer is that the C++11 specification requires your A to be CopyConstructible to be used with std::function .

It's a bug in Visual Studio. It attempts to ellide a copy (when actually it should be trying to ellide a move), which requires an accessible copy constructor. The best solution is simply to declare the copy constructor/assignment operator and never define them.

The class will still be non-copyable but the code will compile, because VS will never attempt to actually call the copy constructor.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions