Template programming beginner problems : <p>I have some basic template programming errors.</p>

<p>I have this code in <code>main.cpp</code>:</p>

<pre><code>#include &lt;string&gt;
#include &lt;iostream&gt;
#include "arrapp.h"
#include &lt;algorithm&gt;
#include &lt;vector&gt;

const int max = 1000;

int main()
{
  int your_mark = 1;
  /* 2-es*/
  int s[] = {3, 2};
  array_appender&lt;int&gt; ia ( s, sizeof( s ) / sizeof( s[ 0 ] ) );
  for( int i = 0; i &lt; max - 1; ++i )
  {
    ia.append( s, sizeof( s ) / sizeof( s[ 0 ] ) );
  }

  std::string hw[] = { "Hello", "World" };
  std::string langs[] = { "C++", "Ada", "Brainfuck" };
  std::string x[] = { "Goodbye", "Cruel", "World" };
  array_appender&lt;std::string&gt; sa ( hw, sizeof( hw ) / sizeof( hw[ 0 ] ) );
  sa.append( langs, sizeof( langs ) / sizeof( langs[ 0 ] ) );
  sa.append( x, sizeof( x ) / sizeof( x[ 0 ] ) );

  const array_appender&lt;std::string&gt; ha( hw, sizeof( hw ) / sizeof( hw[ 0 ] ) );


  if ( max * 2 == ia.size() &amp;&amp; 3 == ia.at( max ) &amp;&amp; 2 == ia.at( 3 ) &amp;&amp;
       &amp;( s[ 0 ] ) == &amp;(ia.at( max / 2 ) ) &amp;&amp; 2 == ha.size() &amp;&amp; 8 == sa.size() &amp;&amp;
       "C++" == sa.at( 2 ) &amp;&amp; 7 == sa.at( 5 ).length() &amp;&amp; &amp;( ha.at( 0 ) ) == hw )
  {
    your_mark = ia.at( max + 1 );
  }
  std::cout &lt;&lt; "Your mark is " &lt;&lt; your_mark;
  std::endl( std::cout );
}
</code></pre>

<p>And I have to solve this, by writing <code>"arrapp.h"</code>. So I created this:</p>

<pre><code>#ifndef arrapp_H
#include &lt;algorithm&gt;
#include &lt;list&gt;
#include &lt;vector&gt;
#include &lt;array&gt;

template &lt;typename T&gt;
T const&amp; array_appender (std::vector &lt;T const&amp;&gt; v, T const&amp; size) {
   std::vector&lt;T*&gt; vec [size]= {};
    for( int idx = 0; idx &lt; size; ++idx)
    {
        std::cout &lt;&lt; "value of v: " &lt;&lt; v[idx] &lt;&lt; std::endl;
        vec.add(v[idx]);
    }
   return vec;
}
#endif // arrapp_H
</code></pre>

<p>But If I use this i got the error <code>main.cpp|14|error: expected ';' before 'ia'|</code>. So this isn't working. How can I create these template things, to work? Am I  misunderstood, here <code>array_appender</code> don't have work as I think, as I wrote?</p>
