<?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 argumentenliste]]></title><description><![CDATA[<p>hallo leute</p>
<p>hab folgenden code:</p>
<pre><code>template&lt;class CHAR, class TRAITS&gt;
class basic_inserter
{
   public:

   basic_inserter(std::basic_istream&lt;char_type, traits_type&gt; &amp;in) : m_stream(in)
   {

   }
};
</code></pre>
<p>jetzt bin ich irgendwie auf den trichter gekommen, das wenn ich folgendes mache:</p>
<pre><code>basic_inserter ins(std::cin);
</code></pre>
<p>das er selber rausfindet was CHAR und TRAITS fuer typen sind.<br />
scheint aber nicht so zu sein.<br />
wie kann ich das nun bewerkstelligen, das ich bei der konstruktion nicht die template parameter mitangeben muss ?<br />
bei einem selbst gebastelten stream, muesste ich sonst zu erst nachgucken welcher CHAR und welche TRAITS verwendet werden.</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/317546/template-argumentenliste</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Jul 2026 14:20:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/317546.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Jun 2013 11:16:15 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 11:16:15 GMT]]></title><description><![CDATA[<p>hallo leute</p>
<p>hab folgenden code:</p>
<pre><code>template&lt;class CHAR, class TRAITS&gt;
class basic_inserter
{
   public:

   basic_inserter(std::basic_istream&lt;char_type, traits_type&gt; &amp;in) : m_stream(in)
   {

   }
};
</code></pre>
<p>jetzt bin ich irgendwie auf den trichter gekommen, das wenn ich folgendes mache:</p>
<pre><code>basic_inserter ins(std::cin);
</code></pre>
<p>das er selber rausfindet was CHAR und TRAITS fuer typen sind.<br />
scheint aber nicht so zu sein.<br />
wie kann ich das nun bewerkstelligen, das ich bei der konstruktion nicht die template parameter mitangeben muss ?<br />
bei einem selbst gebastelten stream, muesste ich sonst zu erst nachgucken welcher CHAR und welche TRAITS verwendet werden.</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2330516</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330516</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Wed, 12 Jun 2013 11:16:15 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 11:20:14 GMT]]></title><description><![CDATA[<p>Wie immer in C++: Das löst man mit Workarounds.</p>
<pre><code>template&lt;class CHAR, class TRAITS&gt;
class basic_inserter
{
   public:

   basic_inserter(std::basic_istream&lt;char_type, traits_type&gt; &amp;in) : m_stream(in)
   {

   }
};
template&lt;class CHAR, class TRAITS&gt;
basic_inserter&lt;CHAR, TRAITS&gt; make_back_inserter(std::basic_istream&lt;char_type, traits_type&gt; &amp;in)
{
  return basic_inserter&lt;CHAR, TRAITS&gt;(in);
}

// dann:
auto ins = make_basic_inserter ins(std::cin);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2330518</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330518</guid><dc:creator><![CDATA[workaround]]></dc:creator><pubDate>Wed, 12 Jun 2013 11:20:14 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 11:51:19 GMT]]></title><description><![CDATA[<p>danke fuer den workaround</p>
<p>basic_inserter ist die basisklasse fuer ne reihe von inserterklassen.<br />
dann muesste ich fuer jede weitere klasse die ich erstelle immer so einen workaround schreiben.+gefaellt mir nicht so sonderlich gut.</p>
<p>gibts da auch noch nen workaround ?</p>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2330531</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330531</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Wed, 12 Jun 2013 11:51:19 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 13:41:54 GMT]]></title><description><![CDATA[<p>hab da einen großen designfehler gehabt.<br />
hab das mal umgestrickt und lass fuer TRAITS mal std::basic_istream&lt;CHAR&gt;::traits_type einsetzen.</p>
<p>noch ne andere frage:<br />
muesste</p>
<pre><code>decltype(std::cin)::char_type c='C';
</code></pre>
<p>das nicht zu</p>
<pre><code>char c='C';
</code></pre>
<p>aufgeloest werden ?<br />
bekomme in VS2012 folgenden fehler:</p>
<pre><code>error C2039: 'char_type': Ist kein Element von '`global namespace''
</code></pre>
<p>Meep Meep</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2330573</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330573</guid><dc:creator><![CDATA[Meep Meep]]></dc:creator><pubDate>Wed, 12 Jun 2013 13:41:54 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 13:57:31 GMT]]></title><description><![CDATA[<p>Meep Meep schrieb:</p>
<blockquote>
<p>gibts da auch noch nen workaround ?</p>
</blockquote>
<p>Nichts mir bekanntes. Auf C++1y warten.</p>
<p>Meep Meep schrieb:</p>
<blockquote>
<p>noch ne andere frage:<br />
muesste</p>
<pre><code>decltype(std::cin)::char_type c='C';
</code></pre>
<p>das nicht zu</p>
<pre><code>char c='C';
</code></pre>
<p>aufgeloest werden ?</p>
</blockquote>
<p>decltype() erlaubt das nicht. Auf C++1y warten. Oder Workaround benutzen:</p>
<pre><code class="language-cpp">// A
std::decay&lt;decltype(std::cin)&gt;::type::char_type;

// B
identity&lt;decltype(std::cin)&gt;::type::char_type;

// C
template &lt;typename T&gt; struct stream_trait {
  typedef typename T::char_type char_type;
};

stream_trait&lt;decltype(std::cin)&gt;::char_type;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2330580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330580</guid><dc:creator><![CDATA[workaround]]></dc:creator><pubDate>Wed, 12 Jun 2013 13:57:31 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 16:26:52 GMT]]></title><description><![CDATA[<p>Meep Meep schrieb:</p>
<blockquote>
<p>muesste</p>
<pre><code>decltype(std::cin)::char_type c='C';
</code></pre>
<p>das nicht zu</p>
<pre><code>char c='C';
</code></pre>
<p>aufgeloest werden ?</p>
</blockquote>
<p>ja</p>
<p>Meep Meep schrieb:</p>
<blockquote>
<p>bekomme in VS2012 folgenden fehler:</p>
<pre><code>error C2039: 'char_type': Ist kein Element von '`global namespace''
</code></pre>
</blockquote>
<p>bug</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2330641</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330641</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Wed, 12 Jun 2013 16:26:52 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 18:57:24 GMT]]></title><description><![CDATA[<p>N3337 schrieb:</p>
<blockquote>
<p>nested-name-specifier:</p>
<ul>
<li>[...]</li>
<li>decltype-specifier::</li>
</ul>
</blockquote>
<p>Ist also legal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2330662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330662</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Wed, 12 Jun 2013 18:57:24 GMT</pubDate></item><item><title><![CDATA[Reply to template argumentenliste on Wed, 12 Jun 2013 19:16:55 GMT]]></title><description><![CDATA[<p><a href="http://www.c-plusplus.net/forum/291806" rel="nofollow">http://www.c-plusplus.net/forum/291806</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2330666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2330666</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 12 Jun 2013 19:16:55 GMT</pubDate></item></channel></rss>