title: SFINAE : class member cannot be redeclared
body: <p>I am trying to create my own "smart iterator" and I'd like to use SFINAE to have some operators depending on the tag of the iterator :</p>
  
  <p>Here is my code :</p>
  
  <pre><code>template&lt;class Iterator, class Predicat, class Tag&gt;
  class RangeFilterIterator {
  public:
      RangeFilterIterator(Iterator begin, Iterator end, Predicat predicat) :
          mBegin(begin), mEnd(end), mPredicat(predicat) {}
  
      bool operator !=(RangeFilterIterator const &amp;r) {
          return mBegin != r.mBegin;
      }
  
      typename Iterator::value_type &amp;operator*() {return *mBegin;}
  
      RangeFilterIterator &amp;operator++() {
          while(mBegin != mEnd &amp;&amp; mPredicat(*mBegin++));
          return *this;
      }
  
      template&lt;class = std::enable_if_t&lt;std::is_base_of&lt;std::random_access_iterator_tag, Tag&gt;::value&gt;&gt;
      RangeFilterIterator &amp;operator+(std::size_t n) {
          while(n--)
              ++(*this);
          return *this;
      }
  
      template&lt;class = std::enable_if_t&lt;!std::is_base_of&lt;std::random_access_iterator_tag, Tag&gt;::value&gt;&gt;
      RangeFilterIterator &amp;operator+(std::size_t n) = delete;
  
  private:
      Iterator mBegin, mEnd;
      Predicat mPredicat;
  };
  
  template&lt;typename Container, typename Predicate&gt;
  auto RangeFilter(Container const &amp;c, Predicate p) {
      using Iterator = RangeFilterIterator&lt;typename Container::iterator,
                                           Predicate,
                                           typename Container::iterator::iterator_category&gt;;
      Iterator begin(const_cast&lt;Container&amp;&gt;(c).begin(), const_cast&lt;Container&amp;&gt;(c).end(), p);
      Iterator end(const_cast&lt;Container&amp;&gt;(c).end(), const_cast&lt;Container&amp;&gt;(c).end(), p);
      return Range(begin, end);
  }
  </code></pre>
  
  <p>and at the line <code>RangeFilterIterator &amp;operator+(std::size_t n) = delete</code> I got the error : <code>class member cannot be redeclared</code>.</p>
  
  <p>I am not "good" with template, but I thought that with SFINAE only one of the two will be "declared". Am I missing something? It is possible to do otherwise?</p>