Trouble assigning a tr1::shared_ptr
- by Max
I've got a class that has a tr1::shared_ptr as a member, like so:
class Foo
{
std::tr1::shared_ptr<TCODBsp> bsp;
void Bar();
}
In member function Bar, I try to assign it like this:
bsp = newTCODBsp(x,y,w,h);
g++ then gives me this error
no match for ‘operator=’ in ‘((yarl::mapGen::MapGenerator*)this)->yarl::mapGen::MapGenerator::bsp = (operator new(40u), (<statement>, ((TCODBsp*)<anonymous>)))’
/usr/include/c++/4.4/tr1/shared_ptr.h:834: note: candidates are: std::tr1::shared_ptr<TCODBsp>& std::tr1::shared_ptr<TCODBsp>::operator=(const std::tr1::shared_ptr<TCODBsp>&)
in my code, Foo is actually yarl::mapGen::MapGenerator. What am I doing wrong?