Note that there are some explanatory texts on larger screens.

plurals
  1. POtemplate <typename T> perculating all through the code
    primarykey
    data
    text
    <p>I <a href="https://stackoverflow.com/questions/7210944/can-t-in-template-typename-t-use-inheritance/7210968">templatized a class earlier</a> and as a result of this templatization, <em>all classes that received objects of this newly templated type require templating as well</em>, even where the templatization is completely irrelevant.</p> <p>So:</p> <ul> <li><code>class Shape</code> is the base class for <code>class Sphere</code>, <code>Cube</code>, <code>Model</code></li> <li>Each <code>Shape</code> contains a <code>Mesh</code></li> <li><code>Mesh</code> has now been templatized to allow for basically the VertexBuffer to have a parameterized type:</li> </ul> <p>So:</p> <pre><code>template &lt;typename T&gt; struct Mesh { VertexBuffer&lt;T&gt; verts ; // Mesh needs to be templated to allow // the vertex buffer to be templated as well } ; </code></pre> <p>So now the class that contains the <code>Mesh</code> (base class <code>Shape</code>) needs to be templated as well:</p> <pre><code>template &lt;typename T&gt; class Shape { Mesh&lt;T&gt;* mesh ; } ; </code></pre> <p><strong>And now</strong>, <em>all</em> the methods anywhere in the code need to be templated <em>as well</em>, even where that templatization in no way affects the code (ie that code has no business with the vertex type of the Mesh member)</p> <p>So for example, the octree node:</p> <pre><code>// An octree node template &lt;typename T&gt; struct ONode // but this class doesn't really benefit // from templatization { AABB bounds ; ONode* parent ; // facilitate movement thru the tree ONode* children[8]; // cells, octants, cubelets Shape&lt;T&gt;* objects ; // for the purposes of the Octree, // But ALL SHAPES BEHAVE THE SAME. &lt;T&gt; serves no purpose </code></pre> <p>This is a really nasty artifact and I'm not sure how to stop the perculation of templatization <em>at an earlier point</em>, or if templatization was a correct choice now that I see how much needs to be templatized.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload