Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. // WORKING
  2. template <class T>
  3. PrioQueue<T> PrioQueue<T>::operator*(PrioQueue<T> other) {
  4. PrioQueue<T> newPrioQueue;
  5.  
  6. while (!this->queue.empty()) {
  7. while (!other.queue.empty()) {
  8. if (this->queue.top() == other.queue.top()) {
  9. newPrioQueue.queue.push(other.queue.top());
  10. }
  11. other.queue.pop();
  12. this->queue.pop();
  13. }
  14. }
  15.  
  16.  
  17. return newPrioQueue;
  18. }
  19.  
  20. // NOT WORKING
  21. template <class T>
  22. PrioQueue<T> PrioQueue<T>::operator*(PrioQueue<T> other) {
  23. PrioQueue<T> newPrioQueue;
  24.  
  25. while (!this->queue.empty()) {
  26. while (!other.queue.empty()) {
  27. if (this->queue.top() == other.queue.top()) {
  28. newPrioQueue.queue.push(other.queue.top());
  29. other.queue.pop();
  30. }
  31. this->queue.pop();
  32. }
  33. }
  34.  
  35.  
  36. return newPrioQueue;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement