I've got a std::list
of std::unique_ptrs
to Entity
objects. When I try to loop through them as such, the program says that the items within the list are inaccessible. The list is a member variable, declared as private: list< unique_ptr >.
void EntityContainer::E_Update(int delta)
{
for (auto& child : children)
child->Update(delta);
}
Where Update()
is a public function of Entity. However, upon compiling, I get the following error:
c:\program files (x86)\microsoft visual studio 11.0\vc\include\xmemory0(617): error C2248:
'std::unique_ptr<_Ty>::unique_ptr'
: cannot access private member declared in class'std::unique_ptr<_Ty>'