インスタンスのセットで範囲ベースの反復子を使用しようとしていunique_ptr
ますが、次のコンパイル エラーが発生します。
C2280: 'std::unique_ptr<Component,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)' : attempting to reference a deleted function
コードの基本は次のとおりです。
#include <set>
#include <memory>
std::set<std::unique_ptr<Component>>* m_components;
class Component
{
void DoSomething(){};
};
void ProcessComponents()
{
for (auto componentsIterator : *m_components)
{
componentsIterator->DoSomething();
componentsIterator++;
}
}
なぜこれが問題になるのか、それを解決する方法はありますか?