Yeah, it does hold a list of observers, using a list<Holder*>. The template class has a holder inside it. i.e
Code:
class Pointee{
list<PointerHolder*> holders;
// plus destructor methods that dissociates this
};
class PointerHolder{
Pointee * thepointed;
// plus destructor methods that dissociates with the pointed pointees
};
template <class SubclassOfPointee>
class Holder{
PointerHolder holder;
// plus a bunch of convenient operators such as:
Holder<SubclassOfPointee>& operator=(SubclassOfPointee * thepointee){
holder.assign(thepointee);
return *this;
}
};
That list of pointers might seem overkill, but I was going to implement it that way for what I needed for keeping track of a bunch of enemies in a game, where they could die any second, and these observers do not own the pointer in any way.