Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by Julio Tentor <jtentor@fi.unju.edu.ar>
- //
- #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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement