aboutsummaryrefslogblamecommitdiffstats
path: root/util/generic/queue.h
blob: f5959f68f28346f53073f06acb1a6ce467d37b8f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
            
                






                         
                           
                                       

                                   
                       
 


                                                    

                         






                                       
  
                                    
                                                           
                                               
       
                       
 


                                                    


                         





                                       
  
#pragma once

#include "fwd.h"
#include "deque.h"
#include "vector.h"
#include "utility.h"

#include <util/str_stl.h>

#include <queue>

template <class T, class S>
class TQueue: public std::queue<T, S> {
    using TBase = std::queue<T, S>;

public:
    using TBase::TBase;

    inline explicit operator bool() const noexcept {
        return !this->empty();
    }

    inline void clear() {
        this->c.clear();
    }

    inline S& Container() {
        return this->c;
    }

    inline const S& Container() const {
        return this->c;
    }
};

template <class T, class S, class C>
class TPriorityQueue: public std::priority_queue<T, S, C> {
    using TBase = std::priority_queue<T, S, C>;

public:
    using TBase::TBase;

    inline explicit operator bool() const noexcept {
        return !this->empty();
    }

    inline void clear() {
        this->c.clear();
    }

    inline S& Container() {
        return this->c;
    }

    inline const S& Container() const {
        return this->c;
    }
};