0

I am implementing deque having the following structure:

template<typename T,
template<typename...> class Container = std::vector>
class Deque {
    public:
       void push_front(const T& obj);
       void emplace_front(T&& obj);
       void push_back(const T& obj);
       void emplace_back(T&& obj);
       auto pop_front();
       auto pop_back();
       std::size_t size() const;
       bool empty() const;
};

I want to support apis like begin(), end(), cbegin() and cend() and they should return stl compliant iterators. I have heard that using std::iterator_traits it can be done. Help pointers in this regard is appreciated.

Also I want the iterators to be of type bidirectional.

abhijit
  • 345
  • 1
  • 3
  • 11
  • 2
    Might be helpful: http://stackoverflow.com/questions/24892998/wrap-iteration-handle-for-use-in-range-based-for-loops. – R Sahu Feb 24 '17 at 16:25
  • Searching for `iterator_traits` in SO throws up a lot of posts. http://stackoverflow.com/search?q=iterator_traits. – R Sahu Feb 24 '17 at 16:26

0 Answers0