<?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[Partielle Template Spezialisierung]]></title><description><![CDATA[<p>Ich schreibe zur Zeit sowas wie ne Traits-Klasse in der ich einen groesseren Parametersatz abhaengig von zwei Parametern kodieren moechte. Aussehen tut das zur Zeit wie folgt:</p>
<pre><code class="language-cpp">//UECOnfig2.h
enum { DIRECT,
       NOMPI,
       s000_033_066,
       s000_090_095,
       s013_033_066,
       s016_033_066,
       s016_090_095,
       s019_033_066 };

enum { PYTHIA62 = 62,
       PYTHIA64 = 64 };

template &lt;int PARAMSET, int PYTVERSION = PYTHIA64&gt;
struct PytParams;  // to be defined only for sXXX_XXX_XXX sets

template&lt;int PYTVERSION&gt;
struct PytParams&lt;s000_033_066, PYTVERSION&gt;  // erster abhaengiger Parametersatz
{
  template &lt;int PYTV&gt;  struct P81;

  template&lt;&gt; struct P81&lt;PYTHIA62&gt;   // line 44
  { enum { min = 11, max = 19 }; }; // line 45

  template&lt;&gt; struct P81&lt;PYTHIA64&gt;
  { enum { min = 13, max = 24 }; };

  typedef P81&lt;PYTVERSION&gt; PARP81;

  enum { CKIN3 = 20,
	 PARP89 = 1000, 
	 PARP90 = 0,
	 PARP85 = 33,
	 PARP86 = 66 };
}; 

template&lt;int PYTVERSION&gt;
struct PytParams&lt;s000_090_095, PYTVERSION&gt; // zweiter abhaengiger Parametersatz
{
  template &lt;int PYTV&gt;  struct P81;

  template&lt;&gt; struct P81&lt;PYTHIA62&gt;
  { enum { min = 11, max = 19 }; };

  template&lt;&gt; struct P81&lt;PYTHIA64&gt;
  { enum { min = 12, max = 20 }; };

  typedef P81&lt;PYTVERSION&gt; PARP81;

  enum { CKIN3 = 20,
	 PARP89 = 1000, 
	 PARP90 = 0,
	 PARP85 = 90,
	 PARP86 = 95 };
};
</code></pre>
<p>Ich moechte damit in etwa folgende Zugriffe ermoeglichen:</p>
<pre><code class="language-cpp">typedef PytParams&lt;s000_090_095&gt; b1;      // PYTVERSION ist PYTHIA64 
typedef PytParams&lt;s000_033_066, PYTHIA62&gt; a2;

cout &lt;&lt; a2::PARP85 &lt;&lt; endl; // 33
cout &lt;&lt; a2::PARP81::min &lt;&lt; endl; // 13
cout &lt;&lt; b1::PARP90 &lt;&lt; endl; // 0
cout &lt;&lt; b1::PARP81::max &lt;&lt; endl; // 20
</code></pre>
<p>Mein Problem ist un folgendes: Der Compiler sagt mir</p>
<pre><code>/blabla/ConfigUE2.h:44: error: explicit
   specialization in non-namespace scope `struct PytParams&lt;2, PYTVERSION&gt;'
/blabla/ConfigUE2.h:44: error: enclosing class
   templates are not explicitly specialized
/blabla/ConfigUE2.h:45: error: template
   parameters not used in partial specialization:
/blabla/ConfigUE2.h:45: error:         `
   PYTVERSION'
</code></pre>
<p>Ich ahb offensichtlich irgendwas an der Syntax des inneren class templates nicht gerafft, kann mir jemand auf die Spruenge helfen wo der fehler ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/186811/partielle-template-spezialisierung</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 12:08:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/186811.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 12 Jul 2007 15:09:09 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 15:09:09 GMT]]></title><description><![CDATA[<p>Ich schreibe zur Zeit sowas wie ne Traits-Klasse in der ich einen groesseren Parametersatz abhaengig von zwei Parametern kodieren moechte. Aussehen tut das zur Zeit wie folgt:</p>
<pre><code class="language-cpp">//UECOnfig2.h
enum { DIRECT,
       NOMPI,
       s000_033_066,
       s000_090_095,
       s013_033_066,
       s016_033_066,
       s016_090_095,
       s019_033_066 };

enum { PYTHIA62 = 62,
       PYTHIA64 = 64 };

template &lt;int PARAMSET, int PYTVERSION = PYTHIA64&gt;
struct PytParams;  // to be defined only for sXXX_XXX_XXX sets

template&lt;int PYTVERSION&gt;
struct PytParams&lt;s000_033_066, PYTVERSION&gt;  // erster abhaengiger Parametersatz
{
  template &lt;int PYTV&gt;  struct P81;

  template&lt;&gt; struct P81&lt;PYTHIA62&gt;   // line 44
  { enum { min = 11, max = 19 }; }; // line 45

  template&lt;&gt; struct P81&lt;PYTHIA64&gt;
  { enum { min = 13, max = 24 }; };

  typedef P81&lt;PYTVERSION&gt; PARP81;

  enum { CKIN3 = 20,
	 PARP89 = 1000, 
	 PARP90 = 0,
	 PARP85 = 33,
	 PARP86 = 66 };
}; 

template&lt;int PYTVERSION&gt;
struct PytParams&lt;s000_090_095, PYTVERSION&gt; // zweiter abhaengiger Parametersatz
{
  template &lt;int PYTV&gt;  struct P81;

  template&lt;&gt; struct P81&lt;PYTHIA62&gt;
  { enum { min = 11, max = 19 }; };

  template&lt;&gt; struct P81&lt;PYTHIA64&gt;
  { enum { min = 12, max = 20 }; };

  typedef P81&lt;PYTVERSION&gt; PARP81;

  enum { CKIN3 = 20,
	 PARP89 = 1000, 
	 PARP90 = 0,
	 PARP85 = 90,
	 PARP86 = 95 };
};
</code></pre>
<p>Ich moechte damit in etwa folgende Zugriffe ermoeglichen:</p>
<pre><code class="language-cpp">typedef PytParams&lt;s000_090_095&gt; b1;      // PYTVERSION ist PYTHIA64 
typedef PytParams&lt;s000_033_066, PYTHIA62&gt; a2;

cout &lt;&lt; a2::PARP85 &lt;&lt; endl; // 33
cout &lt;&lt; a2::PARP81::min &lt;&lt; endl; // 13
cout &lt;&lt; b1::PARP90 &lt;&lt; endl; // 0
cout &lt;&lt; b1::PARP81::max &lt;&lt; endl; // 20
</code></pre>
<p>Mein Problem ist un folgendes: Der Compiler sagt mir</p>
<pre><code>/blabla/ConfigUE2.h:44: error: explicit
   specialization in non-namespace scope `struct PytParams&lt;2, PYTVERSION&gt;'
/blabla/ConfigUE2.h:44: error: enclosing class
   templates are not explicitly specialized
/blabla/ConfigUE2.h:45: error: template
   parameters not used in partial specialization:
/blabla/ConfigUE2.h:45: error:         `
   PYTVERSION'
</code></pre>
<p>Ich ahb offensichtlich irgendwas an der Syntax des inneren class templates nicht gerafft, kann mir jemand auf die Spruenge helfen wo der fehler ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323984</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323984</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 12 Jul 2007 15:09:09 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 15:30:25 GMT]]></title><description><![CDATA[<p>Hallo,<br />
du darfst Templates nur auf Namespace-Ebene spezialisieren, du spezialisierst sie aber innerhalb eines Templates. Gibt zwar Compiler, die Spezialisierung innerhalb einer Klasse erlauben (VC 6.0 z.B.), aber das ist dann eine Spracherweiterung.<br />
Wenn du bei Standard-C++ bleiben willst, musst du dir was anderes überlegen, da du hier eine innere Template-Klasse nicht vollständig spezialisieren kanst ohne die äußere Klasse vollständig zu spezialisieren.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1323999</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1323999</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Thu, 12 Jul 2007 15:30:25 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 15:48:19 GMT]]></title><description><![CDATA[<p>Okay, hab mir jetzt folgendes Ueberlegt: ich leite die Klassen, die von mehr Parametern abhaengen, von denen ab, die von weniger abhaengig sind:</p>
<pre><code class="language-cpp">struct ConstParams
{ enum { CKIN = 20, PARP89 = 1000 }; };

template &lt;int PARAMSET&gt;
struct SetParams;

template &lt;&gt;
struct SetParams&lt;s000_033_066&gt;
{ enum { PARP90 = 0, PARP85 = 33, PARP86 = 66 }; };
struct SetParams&lt;s000_090_095&gt;
{ enum { PARP90 = 0, PARP85 = 90, PARP86 = 95 }; };
struct SetParams&lt;s013_033_066&gt;
{ enum { PARP90 = 13, PARP85 = 33, PARP86 = 66 }; };
struct SetParams&lt;s016_033_066&gt;
{ enum { PARP90 = 16, PARP85 = 33, PARP86 = 66 }; };
struct SetParams&lt;s016_090_095&gt;
{ enum { PARP90 = 16, PARP85 = 90, PARP86 = 95 }; };
struct SetParams&lt;s019_033_066&gt;
{ enum { PARP90 = 19, PARP85 = 33, PARP86 = 66 }; };

template&lt;int PARAMSET, int PYTVERSION&gt;
struct P81;

template &lt;&gt;
struct P81&lt;s000_033_066, PYTHIA64&gt;
{ enum { min = 11, max = 19 }; };

// usw.

template&lt;int PARAMSET, int PYTVERSION&gt;
struct PytParams : public ConstParams, public SetParams&lt;PARAMSET&gt;
{
  typedef P81&lt;PARAMSET, PYTVERSION&gt; PARP81;
};
</code></pre>
<p>Hoffe mal, dass das funktioniert udn Standardkonform ist...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324006</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324006</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 12 Jul 2007 15:48:19 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 16:12:00 GMT]]></title><description><![CDATA[<p>funktioniert auch nicht, weil ich mit dem scope-operator nicht auf geerbte Werte zugreifen kann:</p>
<pre><code>error: `CKIN3' is not a
   member of type `PytParams&lt;2, 64&gt;'
</code></pre>
<p>Jemand ne Idee?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324021</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 12 Jul 2007 16:12:00 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 18:34:46 GMT]]></title><description><![CDATA[<p>Hallo,<br />
zeig doch mal den Code, der diesen Fehler verursacht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324095</guid><dc:creator><![CDATA[HumeSikkins]]></dc:creator><pubDate>Thu, 12 Jul 2007 18:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 23:12:54 GMT]]></title><description><![CDATA[<p>hmm warum überhaupt ConstParams als Basis nutzen?</p>
<p>Ich sehe dafür eigentlich keinen grund, du könntest das enum genauso gut direkt in PytParams haben</p>
<p>Ansonsten schließe ich mich auch HumeSikkins an, zeig mal den code der den Fehler verursacht.</p>
<p>BR<br />
Vinzenz</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324233</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324233</guid><dc:creator><![CDATA[evilissimo]]></dc:creator><pubDate>Thu, 12 Jul 2007 23:12:54 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Thu, 12 Jul 2007 23:40:13 GMT]]></title><description><![CDATA[<p>pumuckl schrieb:</p>
<blockquote>
<p>funktioniert auch nicht, weil ich mit dem scope-operator nicht auf geerbte Werte zugreifen kann:<br />
error: <code>CKIN**3**' is not a member of type</code>PytParams&lt;2, 64&gt;'</p>
<p>Jemand ne Idee?</p>
</blockquote>
<p>schreibfehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324235</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Thu, 12 Jul 2007 23:40:13 GMT</pubDate></item><item><title><![CDATA[Reply to Partielle Template Spezialisierung on Fri, 13 Jul 2007 09:43:08 GMT]]></title><description><![CDATA[<p>evilissimo schrieb:</p>
<blockquote>
<p>hmm warum überhaupt ConstParams als Basis nutzen?</p>
<p>Ich sehe dafür eigentlich keinen grund, du könntest das enum genauso gut direkt in PytParams haben</p>
</blockquote>
<p>kjau habs da mit dem Vererben wohl etwas uebertrieben</p>
<p>camper schrieb:</p>
<blockquote>
<p>schreibfehler?</p>
</blockquote>
<p>ARGS ja, verdammt.</p>
<p>Jetzt klappts...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1324487</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1324487</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Fri, 13 Jul 2007 09:43:08 GMT</pubDate></item></channel></rss>