我有以下代码行
SystemFactory::system_ptr system = _Factory->createSystem(systemType);
_Systems.push_back(std::move(system));
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是我不能只返回系统,因为它在移动后会为NULL.我带来的解决方案如下,我不知道它是否是最好的解决方案.
return (_Systems.end() - 1)->get();
Run Code Online (Sandbox Code Playgroud)
如果有更好的方法吗?