<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[template constructor]]></title><description><![CDATA[<p>Hi,<br />
gibts ne Möglichkeit einen template ctor, dessen Template-Parameter nicht implizit aufgelöst werden kann, explizit aufzurufen? Bzw, ist ein solcher ctor überhaupt erlaubt?</p>
<pre><code class="language-cpp">class foo {
public:
        template &lt;typename T&gt;
        foo() {
          // ...
        }
};
</code></pre>
<p>Sämtliche noch so kreative Aufrufversuche schlugen fehl.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/119203/template-constructor</link><generator>RSS for Node</generator><lastBuildDate>Fri, 21 Aug 2026 20:09:15 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/119203.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 29 Aug 2005 14:06:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template constructor on Mon, 29 Aug 2005 14:06:23 GMT]]></title><description><![CDATA[<p>Hi,<br />
gibts ne Möglichkeit einen template ctor, dessen Template-Parameter nicht implizit aufgelöst werden kann, explizit aufzurufen? Bzw, ist ein solcher ctor überhaupt erlaubt?</p>
<pre><code class="language-cpp">class foo {
public:
        template &lt;typename T&gt;
        foo() {
          // ...
        }
};
</code></pre>
<p>Sämtliche noch so kreative Aufrufversuche schlugen fehl.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/860703</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860703</guid><dc:creator><![CDATA[zeronull]]></dc:creator><pubDate>Mon, 29 Aug 2005 14:06:23 GMT</pubDate></item><item><title><![CDATA[Reply to template constructor on Mon, 29 Aug 2005 14:16:09 GMT]]></title><description><![CDATA[<p>ich hab's nicht hingekriegt, als ich das noch wollte, was aber jahre her ist.</p>
<p>vilelleicht hift sowas?</p>
<pre><code class="language-cpp">template&lt;typename T&gt;
struct TypeProxy{
};

class foo {
public:
        template &lt;typename T&gt;
        foo(TypeProxy&lt;T&gt;) {
          // ...
        }
};
</code></pre>
<p>nebst</p>
<pre><code class="language-cpp">foo f(TypeProxy&lt;int&gt;());
</code></pre>
<p>der proxy sorgt nur dafür, daß du kein echtes objekt nehmen musst zum übergeben, das könnte evtl teuer werden, wenn's ein großer typ ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/860712</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860712</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Mon, 29 Aug 2005 14:16:09 GMT</pubDate></item><item><title><![CDATA[Reply to template constructor on Mon, 29 Aug 2005 14:24:15 GMT]]></title><description><![CDATA[<p>Ja, das wär natürlich eine Möglichkeit, aber mich würd interessieren, obs explizite template ctoren wirklich nicht gibt. Im Standard hab ich nichts drüber gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/860721</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860721</guid><dc:creator><![CDATA[zeronull]]></dc:creator><pubDate>Mon, 29 Aug 2005 14:24:15 GMT</pubDate></item><item><title><![CDATA[Reply to template constructor on Mon, 29 Aug 2005 16:11:06 GMT]]></title><description><![CDATA[<p>zeronull schrieb:</p>
<blockquote>
<p>Ja, das wär natürlich eine Möglichkeit, aber mich würd interessieren, obs explizite template ctoren wirklich nicht gibt. Im Standard hab ich nichts drüber gefunden.</p>
</blockquote>
<p>Kann es nicht geben. Da man Konstruktoren nicht explizit aufrufen kann, kann man bei ihrem Aufruf demzufolge auch nicht explizit die Typen der Templateparameter angeben.</p>
<p>Siehe auch 14.5.2/5 bzw. wiederholt in 14.8.1/5</p>
]]></description><link>https://www.c-plusplus.net/forum/post/860797</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860797</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Mon, 29 Aug 2005 16:11:06 GMT</pubDate></item><item><title><![CDATA[Reply to template constructor on Mon, 29 Aug 2005 17:36:43 GMT]]></title><description><![CDATA[<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/860844</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860844</guid><dc:creator><![CDATA[zeronull]]></dc:creator><pubDate>Mon, 29 Aug 2005 17:36:43 GMT</pubDate></item><item><title><![CDATA[Reply to template constructor on Mon, 29 Aug 2005 17:45:17 GMT]]></title><description><![CDATA[<p>volkard schrieb:</p>
<blockquote>
<pre><code class="language-cpp">template&lt;typename T&gt;
struct TypeProxy{
};

class foo {
public:
        template &lt;typename T&gt;
        foo(TypeProxy&lt;T&gt;) {
          // ...
        }
};
</code></pre>
</blockquote>
<p>und dann bastelt man da vielleicht noch eine schöne funktion drum <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<pre><code class="language-cpp">template&lt;class T&gt;
foo getFoo(){
    return foo(TypeProxy&lt;T&gt;());
}

foo f=getFoo&lt;int&gt;();
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/860847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/860847</guid><dc:creator><![CDATA[otze]]></dc:creator><pubDate>Mon, 29 Aug 2005 17:45:17 GMT</pubDate></item></channel></rss>