Original Post
I'm currently using smart pointers in my game engine, but I'm a little nervous about the performance cost of dereferencing. Here's a really simplified version of my render loop: So to render any object the engine has to: 1) Dereference list< ptr
class Drawable
{
virtual void Render()=0;
};
struct Object
{
ptr<Drawable> drawable;
/* also contains other object properties */
};
for (list< ptr<Object> >::iterator iter = objectList.begin(); iter != objectList.end(); iter++)
{
(*iter)->drawable->Render();
}