object factory for overloaded functions
<p>Usually, an object factory creates instances of classes by calling</p>

<pre><code>auto world = ObjectFactory::instance()-&gt;create("MatrixTransform");
auto cube1 = ObjectFactory::instance()-&gt;create("Cube");
auto sphere = ObjectFactory::instance()-&gt;create("Sphere");
</code></pre>

<p>which uses a map of registered functions with no parameters, such as this one where the class <code>Node</code>is the base class for the classes <code>MatrixTransform</code>, <code>Cube</code> and <code>Sphere</code>:</p>

<pre><code>// Map of registered factory functions
std::map&lt;std::string, std::function&lt;Node *(void)&gt;&gt; functionRegistry;
</code></pre>

<p>Now, I would like to register overloaded constructors taking a limited number of parameters (one or 2), such as <code>MatrixTransform(std::string objectName)</code> or <code>MatrixTransform(std::string objectName, glm::mat4 matrixTransform)</code>, so I can call not only</p>

<pre><code>auto world = ObjectFactory::instance()-&gt;create("MatrixTransform");
</code></pre>

<p>but also</p>

<pre><code>auto world = ObjectFactory::instance()-&gt;create("MatrixTransform", "world");
</code></pre>

<p>and even</p>

<pre><code>auto world = ObjectFactory::instance()-&gt;create("MatrixTransform", "world", "glm::mat4())");
</code></pre>

<p>I know it is possible to store in a map functions having different signatures, meaning functions that have different parameters and/or return types, but how to register functions that have not only different signatures but also the same name, such as the overloaded constructors here above, given that the key in a map must be unique and thus can not be repeated? Could post the whole object factory code if needed. Thank you!</p>