C++ Library & Self registering classes: Factory map empty in client application
问题 Let there be a C++ library (let's call it lib ) which gets included as a static library in an application (let's call it app ). Within the lib there's a base class node . Each subclass of a node is identified by a UUID. I employ a self registering pattern to ensure that new classes register themselves at the factory. The factory allows to build a node subclass object based on the provided UUID. The app builds objects through the lib 's factory::build() function. My factory is based on the