I have a templated API function that takes a container of objects:
template <class Container> void fn(Container *container);
It uses some basic methods of std
containers and expects to find objects that implement some methods.
I have a set/vector/map of pointers to these objects and I need to call this API.
Does anyone see any way of doing this through standard C++ classes? Short of creating a new class that contains a pointer to the original object and reimplements all of its methods through this pointer?
Some kind of generic wrapper that takes a pointer and implements reference-like behavior?
Related questions (if the answer to those was yes, they would have been possible solutions, but it is not the case):