I have a manager that keeps shared_ptr to different type of objects and for all of them provides same specific, but also a common functionality.
I would like to remove the repeating parts with a mixin say like this:
template <typename T>
class ManagerMixin
{
public:
typedef T MixinObject;
typedef std::shared_ptr<MixinObject> MixinObjectSPtr;
MixinObjectSPtr unique(const MixinObjectSPtr& object)
{
return *mMixinObjects.insert(object).first;
}
private:
std::unordered_set<MixinObjectSPtr> mMixinObjects;
};
Now when I inherit this for more than one class say
class Manager : public ManagerMixin<Object1>, public ManagerMixin<Object2>
the unique
method for these both types should be visible, but instead I get
error: member 'unique' found in multiple base classes of different types
Any ideas how I can solve this. From the actual compiler issue to completely different approach.