I currently want the base class also be the factory with static Create function.To make base class does not need to know the imp concrete classes, I try to forward the two core jobs of factory to the concrete class. One is what are the all concretes. Another is how to dispatch it.I try let the concretes to be added by itself. Registered in a global vector with  global instance this of each concrete class. Factory method will iterate all the Method* from vector.The job about what concrete class should be dispatched based on the argument is decided by a virtual boolean function, overridden by concreted class itself and check it can accept or not. struct Method {    virtual void Call() = 0;    virtual bool Accept(const Arg& arg) = 0;        virtual ~Method(){}    static std::vector<Method*> concretes;    static Method* Create(const Arg& arg) {        for(auto m: Method::concretes) {            // Let imp concrete decide accept argument or not            if(m->Accept(arg)) { return m;}        }        return nullptr;    }protected: // Avoid explicitly called by client    Method(){        Method::concretes.push_back(this);    }};// methoda.cppstruct MethodA : Method {        virtual void Call() { ... };    virtual bool Accept(const Arg& arg) { ... };} methoda_ins; // Self registered in base ctor into Method::concretes// methodb.cppstruct MethodB : Method {        virtual void Call() { ... };    virtual bool Accept(const Arg& arg) { ... };} methodb_ins;Is this technique common? Or is there any flaw or drawback I should be careful?Thanks.
Self registration in factory class
c++;object oriented;design patterns