|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Lista dinámica de elementos de tipo T. More...
#include <tpl_dyn_slist_nc.H>
Classes | |
| class | Iterator |
Public Types | |
| typedef Snode_Nc< T > | Node |
Public Member Functions | |
| void | empty () |
| Vacía totalmente a la lista. | |
| T & | insert (const T &data) throw (std::exception, std::bad_alloc) |
| Inserta un elemento al principio de la lista. | |
| T & | append (const T &data) throw (std::exception, std::bad_alloc) |
| Inserta un elemento al final de la lista. | |
| T & | get_first () |
| Retorna una referencia al primer elemento de la lista. | |
| T & | get_last () |
| Retorna una referencia al último elemento de la lista. | |
| T | remove_first () |
| Elimina el primer elemento de la lista: retorna una copia del elemento eliminado. | |
| T & | put (const T &item) |
| Si this es una cola, entonces mete el elemento item. | |
| T | get () |
| Si this es una cola, entonces extrae el elemento más antiguo. | |
| T & | rear () |
| Si this e suna cola, entonces retorna el elemento más joven. | |
| T & | front () |
| Si this e suna cola, entonces retorna el elemento más antiguo. | |
| T & | push (const T &item) |
| Si this es una pila, entonces inserta item. | |
| T | pop () |
| Si this es una pila, entonces elimina el tope. | |
| T & | top () const |
| Si this es una pila, entonces retorna el tope. | |
| const size_t & | size () const |
| Dyn_Slist_Nc () | |
| Constructor vacío. | |
| Dyn_Slist_Nc (const Dyn_Slist_Nc &l) | |
| Constructor de copia. | |
| ~Dyn_Slist_Nc () | |
| Dyn_Slist_Nc & | operator= (const Dyn_Slist_Nc &list) |
| Asignación de lista dinámica con semántica lvalue. | |
| T & | operator[] (const size_t &n) |
Public Member Functions inherited from Aleph::Snode_Nc< T > | |
| Snode_Nc () | |
| Constructor vacío. | |
| Snode_Nc (const T &_data) | |
| Constructor que copia dato. | |
| ~Snode_Nc () | |
| T & | get_data () |
| Retorna una referencia al dato contenido en el nodo. | |
| Snode_Nc * | remove_next () |
| Elimina el nodo siguiente a this. | |
| Snode_Nc *& | get_next () |
| Retorna el nodo siguiente a this. | |
Public Member Functions inherited from Aleph::Slink_Nc | |
| Slink_Nc () | |
| Constructor vacío. | |
| Slink_Nc (const Slink_Nc &) | |
| Constructor copia; coloca enlace a que apunte a nullptr. | |
| ~Slink_Nc () | |
| Slink_Nc & | operator= (const Slink_Nc &link) |
| Asignación; coloca enlace a que apunte a nullptr. | |
| void | reset () |
| Reinicia enlace a que apunte a nullptr. | |
| bool | is_empty () const |
| Retorna true si this está vacío (apunta a nullptr) | |
| Slink_Nc *& | get_next () |
| Retorna el siguiente enlace. | |
| void | insert (Slink_Nc *p) |
| Inserta en enlace p después de this. | |
| Slink_Nc * | remove_next () |
| Elimina el enlace siguiente a this. | |
Private Attributes | |
| Node * | head |
| size_t | num_items |
Additional Inherited Members | |
Protected Attributes inherited from Aleph::Slink_Nc | |
| Slink_Nc * | next |
Lista dinámica de elementos de tipo T.
Dyn_Slist_Nc<T> define una lista dinámica, es una secuencia de elementos de algún tipo T.
Este tipo puede emplearse como pila o cola.
| T | el tipo de elementos de la lista. |
Definition at line 63 of file tpl_dyn_slist_nc.H.
Definition at line 66 of file tpl_dyn_slist_nc.H.
|
inline |
Constructor vacío.
Definition at line 205 of file tpl_dyn_slist_nc.H.
|
inline |
Constructor de copia.
Definition at line 211 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::append(), Aleph::Slink_Nc::Iterator::has_curr(), and l.
|
inline |
Definition at line 218 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::empty().
|
inline | ||||||||||||||||||
Inserta un elemento al final de la lista.
Inserta en la lista this como último elemento una copia de data.
Después de la operación el último elemento de la lista es data.
| [in] | data | el dato a insertarse. |
| bad_alloc | si no hay memoria para el nuevo elemento. |
Definition at line 115 of file tpl_dyn_slist_nc.H.
References Aleph::Snode_Nc< T >::data, Aleph::Snode_Nc< T >::get_data(), Aleph::Dyn_Slist_Nc< T >::head, Aleph::Slink_Nc::insert(), Aleph::maps(), and Aleph::Dyn_Slist_Nc< T >::num_items.
Referenced by Aleph::Dyn_Slist_Nc< T >::Dyn_Slist_Nc(), Aleph::Dyn_Slist_Nc< T >::operator=(), and Aleph::Dyn_Slist_Nc< T >::put().
|
inline |
Vacía totalmente a la lista.
Definition at line 75 of file tpl_dyn_slist_nc.H.
References Aleph::Slink_Nc::is_empty(), Aleph::maps(), Aleph::Dyn_Slist_Nc< T >::num_items, Aleph::Snode_Nc< T >::remove_next(), and Aleph::Slink_Nc::reset().
Referenced by Aleph::Dyn_Slist_Nc< T >::~Dyn_Slist_Nc(), and Aleph::Dyn_Slist_Nc< T >::operator=().
|
inline |
Si this e suna cola, entonces retorna el elemento más antiguo.
Definition at line 170 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::get_first().
|
inline |
Si this es una cola, entonces extrae el elemento más antiguo.
Definition at line 164 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::remove_first().
|
inline |
Retorna una referencia al primer elemento de la lista.
Definition at line 127 of file tpl_dyn_slist_nc.H.
References ah_underflow_error_if, Aleph::Snode_Nc< T >::get_data(), Aleph::Snode_Nc< T >::get_next(), and Aleph::Slink_Nc::is_empty().
Referenced by Aleph::Dyn_Slist_Nc< T >::front(), and Aleph::Dyn_Slist_Nc< T >::top().
|
inline |
Retorna una referencia al último elemento de la lista.
Definition at line 135 of file tpl_dyn_slist_nc.H.
References ah_underflow_error_if, Aleph::Snode_Nc< T >::get_data(), and Aleph::Slink_Nc::is_empty().
Referenced by Aleph::Dyn_Slist_Nc< T >::rear().
|
inline | ||||||||||||||||||
Inserta un elemento al principio de la lista.
Inserta en la lista this como primer elemento una copia de data.
Después de la operación el primer elemento de la lista es data.
| [in] | data | el dato a insertarse. |
| bad_alloc | si no hay memoria para el nuevo elemento. |
Definition at line 94 of file tpl_dyn_slist_nc.H.
References Aleph::Snode_Nc< T >::data, Aleph::Snode_Nc< T >::get_data(), Aleph::Dyn_Slist_Nc< T >::head, Aleph::Slink_Nc::insert(), and Aleph::Dyn_Slist_Nc< T >::num_items.
Referenced by Aleph::Dyn_Slist_Nc< T >::push().
|
inline |
Asignación de lista dinámica con semántica lvalue.
La asignación elimina todos los elementos de this y luego copia en this los elementos contenidos en la lista list.
| [in] | list | lista a ser asignada |
| bad_alloc | si no hay memoria. |
Definition at line 231 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::append(), Aleph::Dyn_Slist_Nc< T >::empty(), Aleph::Slink_Nc::Iterator::has_curr(), Aleph::Slink_Nc::is_empty(), and Aleph::maps().
|
inline |
Definition at line 247 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::Iterator::get_curr(), Aleph::Slink_Nc::Iterator::has_curr(), Aleph::maps(), and Aleph::Slink_Nc::Iterator::next_ne().
|
inline |
Si this es una pila, entonces elimina el tope.
Definition at line 176 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::remove_first().
Si this es una pila, entonces inserta item.
Definition at line 173 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::insert().
Si this es una cola, entonces mete el elemento item.
Definition at line 161 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::append().
|
inline |
Si this e suna cola, entonces retorna el elemento más joven.
Definition at line 167 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::get_last().
|
inline |
Elimina el primer elemento de la lista: retorna una copia del elemento eliminado.
| underflow_error | si la lista está vacía. |
Definition at line 148 of file tpl_dyn_slist_nc.H.
References ah_underflow_error_if, Aleph::Snode_Nc< T >::get_data(), Aleph::Dyn_Slist_Nc< T >::head, Aleph::Slink_Nc::is_empty(), Aleph::maps(), Aleph::Dyn_Slist_Nc< T >::num_items, and Aleph::Snode_Nc< T >::remove_next().
Referenced by Aleph::Dyn_Slist_Nc< T >::get(), and Aleph::Dyn_Slist_Nc< T >::pop().
Definition at line 181 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::num_items.
|
inline |
Si this es una pila, entonces retorna el tope.
Definition at line 179 of file tpl_dyn_slist_nc.H.
References Aleph::Dyn_Slist_Nc< T >::get_first().
|
private |
Definition at line 69 of file tpl_dyn_slist_nc.H.
Referenced by Aleph::Dyn_Slist_Nc< T >::append(), Aleph::Dyn_Slist_Nc< T >::insert(), and Aleph::Dyn_Slist_Nc< T >::remove_first().
|
private |
Definition at line 70 of file tpl_dyn_slist_nc.H.
Referenced by Aleph::Dyn_Slist_Nc< T >::append(), Aleph::Dyn_Slist_Nc< T >::empty(), Aleph::Dyn_Slist_Nc< T >::insert(), Aleph::Dyn_Slist_Nc< T >::remove_first(), and Aleph::Dyn_Slist_Nc< T >::size().