implementation of deque template