//
// Created by Julio Tentor <[email protected]>
//
#ifndef DEMOQUEUE4_SPECIALQUEUE_H
#define DEMOQUEUE4_SPECIALQUEUE_H
#include <queue>
#include <deque>
template <class ELEMENT>
class specialqueue: public std::queue<ELEMENT, std::deque<ELEMENT>> {
public:
specialqueue<ELEMENT> join(specialqueue<ELEMENT> & other);
};
template<class ELEMENT>
specialqueue<ELEMENT> specialqueue<ELEMENT>::join(specialqueue<ELEMENT> & other) {
specialqueue<ELEMENT> result = specialqueue<ELEMENT>();
for (auto it = this->c.begin(); it != this->c.end(); ++it) {
result.push(*it);
}
for (auto it = other.c.begin(); it != other.c.end(); ++it) {
result.push(*it);
}
return result;
}
#endif //DEMOQUEUE4_SPECIALQUEUE_H
Comments