title: How can I implement random access iterators for my container?
body: <p>This is the header file for the container including a try to implement random access iterators : </p>
  
  <pre><code>using namespace std;
  template &lt;class Element, class Compare = std::equal_to&lt;Element&gt;&gt;
  class UniqueArray {
  
  public:
      Element** data;
      unsigned int curr_size;
      unsigned int max_size;
      int* availability_array;
  
      explicit UniqueArray(unsigned int size);
      UniqueArray(const UniqueArray&amp; other);
      ~UniqueArray();
  //    UniqueArray&amp; operator=(const UniqueArray&amp;) = delete;
      unsigned int insert(const Element&amp; element);
      bool getIndex(const Element&amp; element, unsigned int&amp; index) const;
      const Element* operator[] (const Element&amp; element) const;
      bool remove(const Element&amp; element);
      unsigned int getCount() const;
      unsigned int getSize() const;
  
      class Filter {
      public:
          virtual bool operator() (const Element&amp;) const = 0;
      };
      UniqueArray filter(const Filter&amp; f) const;
  
      class UniqueArrayIsFullException{};
  
      typedef Element ua_iterator;
      typedef const Element ua_const_iterator;
  
      ua_iterator begin(){
          return **data;
      }
      ua_const_iterator begin() const {
          return **data;
      }
      ua_iterator end(){
          return *(*data + max_size);
      }
      ua_const_iterator end() const {
          return *(*data + max_size);
      }
  };
  </code></pre>
  
  <p>A summary of the errors I get : </p>
  
  <p><code>error: no match for ‘operator++’</code></p>
  
  <p><code>error: no match for ‘operator*’</code></p>
  
  <p><code>error: no type named ‘value_type’ in ‘struct std::iterator_traits&lt;MtmParkingLot::Vehicle&gt;</code></p>
  
  <p><code>error: no match for ‘operator!=’</code></p>
  
  <p><code>error: no match for ‘operator-’</code></p>
  
  <p>On my implementation <code>Element</code> gets <code>Vehicle</code> and all these missing operators refer to <code>Vehicle</code></p>
  
  <p>I'm not quite sure on how to work on these errors because for example substracting <code>Vehicles</code> makes no sense.. </p>