Trouble assigning a tr1::shared_ptr
Posted
by Max
on Stack Overflow
See other posts from Stack Overflow
or by Max
Published on 2010-06-01T19:40:12Z
Indexed on
2010/06/01
19:43 UTC
Read the original article
Hit count: 238
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?
© Stack Overflow or respective owner