mirror of https://github.com/AxioDL/metaforce.git
CVar: std::move listeners within addListener()
std::function is allowed to heap allocate in order to hold any necessary captures, so we should be std::move-ing instances here in order to avoid potentially performing reallocations.
This commit is contained in:
parent
d39caf54bb
commit
3dc10e7473
|
@ -117,7 +117,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void lock();
|
void lock();
|
||||||
|
|
||||||
void addListener(ListenerFunc func) { m_listeners.push_back(func); }
|
void addListener(ListenerFunc func) { m_listeners.push_back(std::move(func)); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void dispatch();
|
void dispatch();
|
||||||
|
|
Loading…
Reference in New Issue