Skip to content

Instantly share code, notes, and snippets.

@dangkhoasdc
Created November 9, 2018 04:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangkhoasdc/b4ead54c7119eb4887ebbd670ae47289 to your computer and use it in GitHub Desktop.
Save dangkhoasdc/b4ead54c7119eb4887ebbd670ae47289 to your computer and use it in GitHub Desktop.
struct random_access_iterator {
using difference_type = std::ptrdiff_t;
using value_type = ?;
using pointer = value_type*;
using reference = value_type&;
using iterator_category = std::random_access_iterator_tag;
random_access_iterator();
random_access_iterator(const random_access_iterator& rhs);
random_access_iterator(random_access_iterator&& rhs);
random_access_iterator& operator=(const random_access_iterator& rhs);
random_access_iterator& operator=(random_access_iterator&& rhs);
void swap(random_access_iterator& iter);
bool operator==(const random_access_iterator& rhs);
bool operator!=(const random_access_iterator& rhs);
bool operator<(const random_access_iterator& rhs);
bool operator<=(const random_access_iterator& rhs);
bool operator>(const random_access_iterator& rhs);
bool operator>=(const random_access_iterator& rhs);
reference operator*();
pointer operator->();
reference operator[](difference_type n);
random_access_iterator& operator++();
random_access_iterator operator++(int);
random_access_iterator& operator+=(difference_type n);
random_access_iterator operator+(difference_type n);
random_access_iterator& operator--();
random_access_iterator operator--(int);
random_access_iterator& operator-=(difference_type n);
random_access_iterator operator-(difference_type n);
};
void swap(random_access_iterator& lhs, random_access_iterator& rhs);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment