Skip to content
Snippets Groups Projects
Commit c7a5d5d2 authored by Joan Solà Ortega's avatar Joan Solà Ortega
Browse files

Fix making state blocks -- forgot make_shared<>

parent 1bb7dca7
No related branches found
No related tags found
1 merge request!323Resolve "New data structure for storing stateblocks"
Pipeline #4336 passed
......@@ -94,7 +94,7 @@ template<typename SB, typename ... Args>
inline std::shared_ptr<SB> HasStateBlocks::emplaceStateBlock(const std::string& _sb_type, Args&&... _args_of_derived_state_block_constructor)
{
assert(state_block_map_.count(_sb_type) == 0 && "Trying to add a state block with an existing type!");
std::shared_ptr<SB> sb(std::forward<Args>(_args_of_derived_state_block_constructor)...);
std::shared_ptr<SB> sb = std::make_shared<SB>(std::forward<Args>(_args_of_derived_state_block_constructor)...);
state_block_map_.emplace(_sb_type, sb);
return sb;
}
......@@ -103,7 +103,7 @@ template<typename ... Args>
inline StateBlockPtr HasStateBlocks::emplaceStateBlock<StateBlock>(const std::string& _sb_type, Args&&... _args_of_base_state_block_constructor)
{
assert(state_block_map_.count(_sb_type) == 0 && "Trying to add a state block with an existing type!");
std::shared_ptr<StateBlock> sb(std::forward<Args>(_args_of_base_state_block_constructor)...);
std::shared_ptr<StateBlock> sb = std::make_shared<StateBlock>(std::forward<Args>(_args_of_base_state_block_constructor)...);
state_block_map_.emplace(_sb_type, sb);
return sb;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment