C++ Generic Callback class with removable listeners by unique id I'm quite new to the STL.
Does this make sense? Is there a better way of removing the listeners instead of using shared_ptr while keeping the code short and simple? Is there something in the STL to replace this?
Class:
template&lt;class ... Arguments&gt;
class Callback
{
    using Function = std::function&lt;void(Arguments ...)&gt;;
    using FunctionPtr = std::shared_ptr&lt;Function&gt;;
    using Functions = std::vector&lt;FunctionPtr&gt;;

public:
    FunctionPtr addListener(Function f) {
        FunctionPtr fp = std::make_shared&lt;Function&gt;(f);
        _functions.push_back(fp);
        return fp;
    }

    void removeListener(FunctionPtr fp){
        _functions.erase(std::find(_functions.begin(), _functions.end(), fp));
    }

    void operator()(Arguments ... args) const{
        for (auto &amp; f : _functions)
            f.get()-&gt;operator()( args ... );
    }

private:
    Functions _functions;
};

Use case:
int main()
{
    Callback&lt;int&gt; callback;

    callback.addListener([](int i){
        std::cout &lt;&lt; &quot;Listener 1 -&gt; Input is &quot; &lt;&lt; i &lt;&lt;  std::endl;
    });

    auto id = callback.addListener([](int i){
        std::cout &lt;&lt; &quot;Listener 2 -&gt; Input is &quot; &lt;&lt; i &lt;&lt;  std::endl;
    });

    callback.addListener([](int i){
        std::cout &lt;&lt; &quot;Listener 3 -&gt; Input is &quot; &lt;&lt; i &lt;&lt;  std::endl;
    });

    callback.removeListener(id);

    callback(71);
}

Output is:
Listener 1 -&gt; Input is 71
Listener 3 -&gt; Input is 71
I think this makes sense in terms of STL use.  Storing a std::shared_ptr&lt;std::function&gt; is not usually necessary since std::function may own heap allocations internally, but since you return the shared_ptr from addListener it could be passed around.  If you never use the returned shared_ptr, you could just store a std::vector&lt;std::function&gt; and return a handle for removal (maybe the handle could contain the index of the function in the vector?).
I can't say whether a vector of functions makes sense for your use case.  If you can avoid callbacks and call functions directly, that's definitely preferable -- makes optimization much easier for the compiler.

Other stuff:
class Callback
{
    using Function = std::function&lt;void(Arguments ...)&gt;;

These typedefs are nice, but could be better.  They should be public since they are used in the public API.  And perhaps the names could be clearer (e.g. VecPtrFunc instead of Functions)?
_functions.erase(std::find(_functions.begin(), _functions.end(), fp));

This seems OK, but if you call this a lot or if functions is big, this will be slow. You might prefer to use a data structure with sub linear lookup/delete like std::map or std::unordered_map.  Or you could use the index-handle idea above and remove from a vector more efficiently.
void operator()(Arguments ... args) const

If you were just calling one callee, this would be Arguments&amp;&amp; and you'd std::forward the args.  Since you use the args... in a loop, I guess this is fine.  Maybe Arguments const&amp; is better in case folks pass in big types and don't want to copy?