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.