title: How do I perform an addition of a templated struct?
body: <p>Currently I'm learning about structs and templated. I have a templated struct:</p>
  <pre><code>template&lt;int value&gt;
  struct ConstInt
  {
      static int  eval()
      {
          return value; 
      };
  };
  </code></pre>
  <p>I want to achieve the following:</p>
  <blockquote>
  <p>Create an Add struct template that take two structs as template
  parameters.</p>
  </blockquote>
  <p>An example of the usage is given below:</p>
  <pre><code>typedef Add&lt;f, g&gt; h; // represents the function h(x) = f(x) + g(x)
  </code></pre>
  <p><strong>What I did</strong></p>
  <p>I first wrote a new templated struct:</p>
  <pre><code>template&lt;ConstInt f, ConstInt g&gt;
  Struct Add
  {
      return f + h; 
  }
  </code></pre>
  <p>Operator overloading needs to be applied in my opinion:</p>
  <pre><code>ConstInt operator+(const ConstInt &amp;other) const
  {
          ConstInt temp1;
          temp1.value = value - other.value;
          return temp1;   
  }
  </code></pre>
  <p>Here is where is goes wrong. I get the following error:</p>
  <blockquote>
  <p>error: template placeholder type 'const ConstInt&lt;...auto...&gt;' must be
  followed by a simple declarator-id</p>
  </blockquote>
  <p><strong>Help</strong></p>
  <p>In the first place I am not sure if my 'method' is the right way to achieve the task. This error doesn't make it clear to me why it fails. Could I please get feedback on this?</p>
  <p>Nadine :)</p>