title: Expected unqualified-id before token
body: <p>Edit: One of the sites I've looked at that leads me to believe my syntax is correct: <a href="http://www.cprogramming.com/tutorial/templates.html" rel="nofollow">http://www.cprogramming.com/tutorial/templates.html</a></p>
  
  <p>I've explored around Google a good deal before coming here to ask this question, since near as I can tell I've written things properly according to the examples that I have seen.  For a homework assignment, writing a template class that does some extremely basic math stuff (sum, average, minimum, maximum, etc).  When I attempt to compile to try and start debugging, I end up with the following error.</p>
  
  <pre><code>error: expected unqualified-id before '&lt;' token
  </code></pre>
  
  <p>Following is somewhat snipped code, prototypes and a few lines before the chunk that errors.  The code throws the error on the second line (the ones that start with lessthansymbol myType greaterthansymbol).  I'm sure once I get past this I'll have plenty more things to debug with the program, but this is completely holding me up at the moment.</p>
  
  <pre><code>template &lt;class myType&gt;
  class simpleSet
  {
      public:
  
      static const int VALUE_MAX = 1000;
      static const int CNT_MIN = 10;
      static const int CNT_MAX = 500;
  
      simpleSet();
      simpleSet(int, myType[]);
      ~simpleSet();
      void gnomeSort();
      void generateNewSet(int);
      myType minimum() const;
      myType maximum() const;
      myType median() const;
      myType sum() const;
      myType average() const;
      myType linearRegression(const simpleSet&amp;) const;
      myType getDatum(int) const;
      void setDatum(int, myType);
      int getLength() const;
      void printSet() const;
      int readCount();
  
  private:
  
      int setLength;
      myType *mySet;
  };
  
  template &lt;class myType&gt;
  void simpleSet&lt;myType&gt;::generateNewSet(int size)
  {
      setLength = size;
      for (int i = 0; i &lt; setLength; i++)
      {
          mySet[i] = static_cast&lt;myType&gt;((myType(rand()%VALUE_MAX)));
          if (mySet[i] &lt; 1 || mySet[i] &gt; VALUE_MAX)
          {
              i--;
              continue;
          }
      }
  }
  
  template &lt;class myType&gt;
  &lt;myType&gt; simpleSet&lt;myType&gt;::maximum() const
  {
      myType worker = mySet[0];
      for (int i = 0; i &lt; setSize; i++)
      {
          if (worker &lt; mySet[i]) worker = mySet[i];
      }
      return worker;
  }
  
  template &lt;class myType&gt;
  &lt;myType&gt; simpleSet&lt;myType&gt;::minimum() const
  {
      myType worker = mySet[0];
      for (int i = 0; i &lt; setSize; i++)
      {
          if (worker &gt; mySet[i]) worker = mySet[i];
      }
      return worker;
  }
  
  template &lt;class myType&gt;
  &lt;myType&gt; simpleSet&lt;myType&gt;::median() const
  {
      if (setSize == 1) return mySet[0];
      else if ((setSize % 2) == 1) return (mySet[(setSize/2)]);
      else return (average((mySet[setSize/2] + mySet[(setSize/2)-1])));
  }
  
  template &lt;class myType&gt;
  &lt;myType&gt; simpleSet&lt;myType&gt;::sum() const
  {
      myType temp;
  for (i = 0; i &lt; setSize; i++) temp = temp + mySet[i];
  return temp;
  }
  
  template &lt;class myType&gt;
  &lt;myType&gt; simpleSet&lt;myType&gt;::average() const
  {
      return (mySet.sum()/setSize);
  }
  
  template &lt;class myType&gt;
  &lt;myType&gt; simpleSet&lt;myType&gt;::getDatum(int item) const
  {
      return(myset[item]);
  }
  </code></pre>