queue.h 1017 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #pragma once
  2. #include "fwd.h"
  3. #include "deque.h"
  4. #include "vector.h"
  5. #include "utility.h"
  6. #include <util/str_stl.h>
  7. #include <queue>
  8. template <class T, class S>
  9. class TQueue: public std::queue<T, S> {
  10. using TBase = std::queue<T, S>;
  11. public:
  12. using TBase::TBase;
  13. inline explicit operator bool() const noexcept {
  14. return !this->empty();
  15. }
  16. inline void clear() {
  17. this->c.clear();
  18. }
  19. inline S& Container() {
  20. return this->c;
  21. }
  22. inline const S& Container() const {
  23. return this->c;
  24. }
  25. };
  26. template <class T, class S, class C>
  27. class TPriorityQueue: public std::priority_queue<T, S, C> {
  28. using TBase = std::priority_queue<T, S, C>;
  29. public:
  30. using TBase::TBase;
  31. inline explicit operator bool() const noexcept {
  32. return !this->empty();
  33. }
  34. inline void clear() {
  35. this->c.clear();
  36. }
  37. inline S& Container() {
  38. return this->c;
  39. }
  40. inline const S& Container() const {
  41. return this->c;
  42. }
  43. };