title: C++ "...does not name a type"
body: <p>I've been trying to define a class method which uses a return type declared in the class namespace:</p>
  
  <pre><code>template&lt;class T, int SIZE&gt;
  class SomeList{
  
  public:
  
      class SomeListIterator{
          //...
      };
  
      using iterator = SomeListIterator;
  
      iterator begin() const;
  
  };
  
  template&lt;class T, int SIZE&gt;
  iterator SomeList&lt;T,SIZE&gt;::begin() const {
      //...
  }
  </code></pre>
  
  <p>When I try to compile the code, I'm getting this error:</p>
  
  <pre><code>Building file: ../SomeList.cpp
  Invoking: GCC C++ Compiler
  g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"SomeList.d" -MT"SomeList.d" -o "SomeList.o" "../SomeList.cpp"
  ../SomeList.cpp:17:1: error: ‘iterator’ does not name a type
   iterator SomeList&lt;T,SIZE&gt;::begin() const {
   ^
  make: *** [SomeList.o] Error 1
  </code></pre>
  
  <p>I Also tried to define the method like this:</p>
  
  <pre><code>template&lt;class T, int SIZE&gt;
  SomeList::iterator SomeList&lt;T,SIZE&gt;::begin() const {
      //...
  }
  </code></pre>
  
  <p>And this:</p>
  
  <pre><code>template&lt;class T, int SIZE&gt;
  SomeList&lt;T,SIZE&gt;::iterator SomeList&lt;T,SIZE&gt;::begin() const {
      //...
  }
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>Building file: ../SomeList.cpp
  Invoking: GCC C++ Compiler
  g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"SomeList.d" -MT"SomeList.d" -o "SomeList.o" "../SomeList.cpp"
  ../SomeList.cpp:17:1: error: invalid use of template-name ‘SomeList’ without an argument list
   SomeList::iterator SomeList&lt;T,SIZE&gt;::begin() const {
   ^
  make: *** [SomeList.o] Error 1
  </code></pre>
  
  <p>What am I doing wrong?</p>