<?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[partial-template-specialization]]></title><description><![CDATA[<p>ich habe eine klasse:</p>
<pre><code>template&lt;
   class char_type, 
   class traits_type=std::char_traits&lt;char_type&gt;,
   class allocator_type=std::allocator&lt;char_type&gt;
&gt;
class basic_archive{
   static const char_type* mark;
};
</code></pre>
<p>nun will ich einen standartwert für 'mark' setzen:<br />
(beispiel für char_type == 'char')</p>
<pre><code>template&lt;class traits_type,class allocator_type&gt;
const char* basic_archive&lt;char,traits_type,allocator_type&gt;::mark = &quot;mark&quot;;
</code></pre>
<p>allerdings gibt es einen fehler:</p>
<blockquote>
<p>error C3860: template argument list following class template name must list parameters in the order used in template parameter list</p>
</blockquote>
<p>leider weiß ich nicht wie ich es anders machen sollte und wäre dankbar für eure hilfe <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>
<p>PS: vorübergehend habe ich es folgendermaßen gelöst:</p>
<pre><code>template&lt;class char_type&gt;
class mark_helper{
   static const char_type* mark;
};
template&lt;&gt;
const char* mark_helper&lt;char&gt;::mark;
</code></pre>
<p>und darauf dann in basic_archive zugegriffen, aber das geht doch bestimmt auch schöner <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/314776/partial-template-specialization</link><generator>RSS for Node</generator><lastBuildDate>Fri, 31 Jul 2026 23:32:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/314776.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Mar 2013 19:26:04 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to partial-template-specialization on Wed, 13 Mar 2013 19:26:04 GMT]]></title><description><![CDATA[<p>ich habe eine klasse:</p>
<pre><code>template&lt;
   class char_type, 
   class traits_type=std::char_traits&lt;char_type&gt;,
   class allocator_type=std::allocator&lt;char_type&gt;
&gt;
class basic_archive{
   static const char_type* mark;
};
</code></pre>
<p>nun will ich einen standartwert für 'mark' setzen:<br />
(beispiel für char_type == 'char')</p>
<pre><code>template&lt;class traits_type,class allocator_type&gt;
const char* basic_archive&lt;char,traits_type,allocator_type&gt;::mark = &quot;mark&quot;;
</code></pre>
<p>allerdings gibt es einen fehler:</p>
<blockquote>
<p>error C3860: template argument list following class template name must list parameters in the order used in template parameter list</p>
</blockquote>
<p>leider weiß ich nicht wie ich es anders machen sollte und wäre dankbar für eure hilfe <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>
<p>PS: vorübergehend habe ich es folgendermaßen gelöst:</p>
<pre><code>template&lt;class char_type&gt;
class mark_helper{
   static const char_type* mark;
};
template&lt;&gt;
const char* mark_helper&lt;char&gt;::mark;
</code></pre>
<p>und darauf dann in basic_archive zugegriffen, aber das geht doch bestimmt auch schöner <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2306477</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2306477</guid><dc:creator><![CDATA[gamer8o4]]></dc:creator><pubDate>Wed, 13 Mar 2013 19:26:04 GMT</pubDate></item><item><title><![CDATA[Reply to partial-template-specialization on Wed, 13 Mar 2013 20:35:31 GMT]]></title><description><![CDATA[<p>So direkt geht das leider nicht.</p>
<p>Als allgemein gutes Design würde ich dir allerdings raten, Member, die nur vom <code>char_type</code> abhängen, auszulagern:</p>
<pre><code class="language-cpp">template&lt;class char_type&gt;
class basic_archive_impl {
  static const char_type* mark;
};
template&lt;&gt; const char* basic_archive_impl&lt;char&gt;::mark = &quot;mark&quot;;

template&lt;
  class char_type,
  class traits_type=std::char_traits&lt;char_type&gt;,
  class allocator_type=std::allocator&lt;char_type&gt;
  &gt;
class basic_archive : basic_archive_impl&lt;char_type&gt; {
};
</code></pre>
<p>Einer der Vorteile ist, dass die Funktionen innerhalb von <code>basic_archive_impl</code> nur einmal pro <code>char_type</code> definiert werden, während sie in deinem Ansatz unter Umständen mehrfach vorkommen würden (wegen anderem Trait oder Allocator).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2306492</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2306492</guid><dc:creator><![CDATA[élève ator]]></dc:creator><pubDate>Wed, 13 Mar 2013 20:35:31 GMT</pubDate></item><item><title><![CDATA[Reply to partial-template-specialization on Wed, 13 Mar 2013 20:41:24 GMT]]></title><description><![CDATA[<p><code>s/definiert/instanziiert/</code></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2306496</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2306496</guid><dc:creator><![CDATA[élève ator]]></dc:creator><pubDate>Wed, 13 Mar 2013 20:41:24 GMT</pubDate></item><item><title><![CDATA[Reply to partial-template-specialization on Wed, 13 Mar 2013 20:45:31 GMT]]></title><description><![CDATA[<p>okay, also war ich auf dem richtigen weg <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="🙂"
    /><br />
danke für deine hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2306497</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2306497</guid><dc:creator><![CDATA[gamer8o4]]></dc:creator><pubDate>Wed, 13 Mar 2013 20:45:31 GMT</pubDate></item></channel></rss>