私のコードについて意見が欲しいです。カスタム コンテナ用のランダム アクセス イテレータが必要です。C++ 2011 標準、特に第 24 章を読むと、実装が次のようになる可能性があることがわかりました。
class my_iterator : public std::iterator<std::random_access_iterator_tag, my_element>
{
private:
my_container *_ref;
my_iterator_state state; // some useful state
public:
my_iterator ();
my_iterator (const my_iterator &);
my_iterator (my_iterator &&);
~my_iterator ();
my_iterator &operator = (const my_iterator &);
my_iterator &operator = (my_iterator &&);
reference operator * ();
my_iterator &operator ++ ();
bool operator != (my_iterator);
value_type operator * ();
pointer operator -> ();
my_iterator &operator * ();
void operator ++ (int);
value_type operator ++ (int);
const my_iterator &operator ++ (int);
reference operator ++ (int);
my_iterator &operator -- ();
const my_iterator operator -- (int);
reference operator -- (int);
my_iterator &operator += (difference_type);
my_iterator operator + (difference_type);
my_iterator operator - (difference_type);
reference operator [] (difference_type);
bool operator < (my_iterator);
bool operator > (my_iterator);
bool operator <= (my_iterator);
bool operator >= (my_iterator);
friend difference_type (my_iterator, my_iterator);
friend my_iterator operator + (difference_type, my_iterator);
friend void swap (iterator &, iterator &);
};
void swap (iterator &, iterator &);
difference_type (my_iterator, my_iterator);
my_iterator operator + (difference_type, my_iterator);
上記の実装は正しく、フル機能ですか? メンバー多すぎない?