Mir

Code review comment for lp:~mir-team/mir/multiple-change-callbacks

Revision history for this message
Alberto Aguirre (albaguirre) wrote :

> (2) Needs Information: We potentially don't need to use ObserverId. The
> std::function is already unique and has operator== so could be used as the
> identifier itself...
> 48 + virtual scene::ObserverId
> add_change_callback(std::function<void()> const& f) = 0;
> 49 + virtual void remove_change_callback(scene::ObserverId id) = 0;
> Then notify_change_by_id could become a std::set with a custom Compare
> template parameter. Or more simply a std::list with std::find.
>

This imposes the caller to save the std::function it passed even if they are lambdas, which is probably more awkward than obtaining an id.

« Back to merge proposal