Pergunta

I've found that the following code doesn't compile in Visual Studio 2010 (but works fine in GCC):

using namespace std;
unique_ptr<string> up(new string("abc"));
auto bound = bind(&string::size, move(up));
bound();

The error I get is:

'std::unique_ptr<_Ty>::unique_ptr' : cannot access private member declared in class 'std::unique_ptr<_Ty>'

Is it because the VS2010 bind implementation just doesn't support move only types?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top