Class for merging callbacks with the same signature in C++