I have the following line of code
SystemFactory::system_ptr system = _Factory->createSystem(systemType);
_Systems.push_back(std::move(system));
The problem that I have is I can't just return the system as it will NULL it after moving it. The solution that I came with is the following and I don't know if it's the best one.
return (_Systems.end() - 1)->get();
If there is a better way of doing this?