Aleph-w  1.9
General library for algorithms and data structures
Stack.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_STACK_H
28 # define AH_STACK_H
29 
30 # include <tpl_dynListStack.H>
31 
32 
33 namespace Aleph {
34 
44  template <typename T>
45 class stack : public Aleph::DynListStack<T>
46 {
47 public:
48 
50  typedef T value_type;
51 
53  typedef size_t size_type;
54 
56  stack() { /* empty */ }
57 
59  template <class Container>
60  stack(Container & cont)
61  {
62  const typename Container::iterator end = cont.end();
63 
64  for (typename Container::iterator it(cont.begin()); it != end; push(it++));
65  }
66 
68  bool empty() const { return this->is_empty(); }
69 };
70 
71 } // end namespace Aleph
72 
73 # endif // AH_STACK_H
Definition: Stack.H:45
stack()
Instancia una pila vacía.
Definition: Stack.H:56
T & push(const T &item)
Definition: htlist.H:1432
bool is_empty() const noexcept
Definition: htlist.H:466
Definition: ah-comb.H:35
T value_type
El tipo de valor que guarda la pila.
Definition: Stack.H:50
stack(Container &cont)
Instancia una pila con los elementos del contenedor cont.
Definition: Stack.H:60
bool empty() const
Retorna true si la pila está vacía.
Definition: Stack.H:68
Definition: ahDry.H:41
size_t size_type
Tipo numérico para tamaño de pila.
Definition: Stack.H:53

Leandro Rabindranath León