Skip to content

Commit

Permalink
Use emplace instead of insert/push in ObserverPool::add
Browse files Browse the repository at this point in the history
  • Loading branch information
frmdstryr committed Feb 1, 2025
1 parent 0750392 commit 8723c0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions atom/src/observerpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ObserverPool::add( cppy::ptr& topic, cppy::ptr& observer, uint8_t change_types )
}
if( obs_free == obs_end )
{
m_observers.insert( obs_end, Observer( observer, change_types ) );
m_observers.emplace( obs_end, observer, change_types );
++topic_it->m_count;
}
else
Expand All @@ -138,8 +138,8 @@ ObserverPool::add( cppy::ptr& topic, cppy::ptr& observer, uint8_t change_types )
}
obs_offset += topic_it->m_count;
}
m_topics.push_back( Topic( topic, 1 ) );
m_observers.push_back( Observer(observer, change_types) );
m_topics.emplace_back( topic, 1 );
m_observers.emplace_back( observer, change_types );
}


Expand Down

0 comments on commit 8723c0b

Please sign in to comment.