
On Thu, Dec 3, 2009 at 3:24 PM, Jeremy Pack <rostovpack@gmail.com> wrote:
Your example uses a centralized place (the type-map) to store the information about the derived classes/plugins. That is what I'm aiming to avoid with my static plugin library.
I did this because I figured it would be trivial for a user who wanted it global to make it global. It is just like your "Factory Manager", but it can be either global or local (with simple wrapper functions).
You could make it safe with the static initialization by making sure that the Factory Manager is initialized before it is used. For your use case, I think it would be sufficient to instantiate the Factory Manager inside of the function that returns it (Get() below):
Which is what I do in the code I demonstrated, as I said... I am quite sure my emails are going to the list just fine...