Listener callback functions
Try this:

struct MyListener
{
    virtual void on_data(int value) = 0;    // same function name
    virtual void on_data(string value) = 0; // same function name
    ...
};

template&lt;typename T&gt;
void MyClass::trigger_data_event(T&amp;&amp; value) // pass by universal reference
{
    auto iter = _listeners.begin(); // consider using auto where appropriate

    while (iter != _listeners.end())
    {
        // don't use expired here: it involves concurrency issues if the pointer
        // is invalidated between calling expired and lock

        // instead, just lock() and check the result:

        if(auto p = iter-&gt;lock())
        {
            p-&gt;on_data(std::forward&lt;T&gt;(value)); // works with both callbacks
            ++iter;
        }
        else
            iter = _listeners.erase(iter);
    }
}


I renamed the APIs you used from callback1/2 to on_data (same name) and unified the implementations of fireCallback1 and fireCallback2.