std::list
은 std::unique_ptrs
에서 Entity
까지입니다. 그 (것)들을 통해 그 (것)들을 통해서 반복 할 것을 시도 할 때, 프로그램은 명부 내의 품목이 접근 가능하다는 것을 말한다. 목록은 private 변수로 선언 된 멤버 변수입니다. list < unique_ptr>.unique_ptr 목록의 내용에 액세스 할 수 없습니다.
void EntityContainer::E_Update(int delta)
{
for (auto& child : children)
child->Update(delta);
}
여기서 Update()
은 Entity의 공개 기능입니다. 당신은 unique_ptr
을 복사하려는
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>'
참조를 사용하여보십시오 : 'unique_ptr & child : children'. unique_ptrs를 복사하려고합니다. –
juanchopanza