Skip to content
  • Mark OLESEN's avatar
    ENH: define singleton-style lookups for runTime selection, alias handling · 4fc6ec1d
    Mark OLESEN authored
    - this makes the lookup and use of tables slightly cleaner and
      provides a hook for update (compat) messages
    
      The singleton-style method returns the function pointer directly,
      or nullptr on not-found.
    
      NEW access method (mnemonic: 'ctor' prefix for constructors)
    
      ```
      auto* ctorPtr = dictionaryConstructorTable(modelType);
    
      if (!ctorPtr)
      {
          ...
      }
    
      return autoPtr<myModel>(ctorPtr(dict, ...));
      ```
    
      OLD method, which also still works, but without any compat handling:
    
      ```
      auto ctorIter = dictionaryConstructorTablePtr_->cfind(modelType);
    
      if (!ctorIter.found())
      {
          ...
      }
    
      return autoPtr<myModel>(ctorIter()(dict, ...));
      ```
    4fc6ec1d