I'm trying to use a range based iterator with a set of unique_ptr
instances but I'm getting the following compilation error:
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
The basics of the code is below:
#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++;
}
}
Any idea why this would be a problem or how to solve it?