Aleph-w  1.9
General library for algorithms and data structures
Queue.H
1 
2 /* Aleph-w
3 
4  / \ | | ___ _ __ | |__ __ __
5  / _ \ | |/ _ \ '_ \| '_ \ ____\ \ /\ / / Data structures & Algorithms
6  / ___ \| | __/ |_) | | | |_____\ V V / version 1.9b
7  /_/ \_\_|\___| .__/|_| |_| \_/\_/ https://github.com/lrleon/Aleph-w
8  |_|
9 
10  This file is part of Aleph-w library
11 
12  Copyright (c) 2002-2018 Leandro Rabindranath Leon & Alejandro Mujica
13 
14  This program is free software: you can redistribute it and/or modify
15  it under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  This program is distributed in the hope that it will be useful, but
20  WITHOUT ANY WARRANTY; without even the implied warranty of
21  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  General Public License for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with this program. If not, see <https://www.gnu.org/licenses/>.
26 */
27 # ifndef AH_QUEUE_H
28 # define AH_QUEUE_H
29 
30 # include <tpl_dynListQueue.H>
31 
32 namespace Aleph {
33 
43  template <class T>
44 class queue : public Aleph::DynListQueue<T>
45 {
46 public:
47 
49  typedef size_t size_type;
50 
52  queue() { /* empty */ }
53 
55  template <class Container>
56  queue(Container & cont)
57  {
58  const typename Container::iterator end = cont.end();
59 
60  for (typename Container::iterator it(cont.begin()); it != end; put(it++));
61  }
62 
64  void push(const T & value) { put(value); }
65 
67  void pop() { this->get(); }
68 
70  T & back() { return this->rear(); }
71 
73  bool empty() const { return this->is_empty(); }
74 };
75 
76 } // end namespace Aleph
77 
78 # endif // AH_QUEUE_H
79 
T & rear() const
Return a modifiable reference to the youngest item in the queue.
Definition: tpl_dynListQueue.H:179
queue(Container &cont)
Instancia una cola con los elementos del contenedor cont.
Definition: Queue.H:56
Definition: Queue.H:44
bool is_empty() const noexcept
rioReturn true if this is empty
Definition: tpl_dynListQueue.H:112
bool empty() const
Retorna true la cola está vacía.
Definition: Queue.H:73
Definition: tpl_dynListQueue.H:50
size_t size_type
El tipo numérico para representar el tamaño.
Definition: Queue.H:49
void pop()
Elimina un elemento del frente de la cola.
Definition: Queue.H:67
Definition: ah-comb.H:35
queue()
Instancia una cola vacía.
Definition: Queue.H:52
T & back()
Consulta el elemento trasero de la cola.
Definition: Queue.H:70
void push(const T &value)
Inserta value en la cola.
Definition: Queue.H:64
T & put(const T &data)
The type of element.
Definition: tpl_dynListQueue.H:125

Leandro Rabindranath León