AlgoPlus v0.1.0
|
single linked list class More...
#include <linked_list.h>
Classes | |
class | Iterator |
Iterator class. More... | |
Public Member Functions | |
linked_list (std::vector< T > _elements={}) noexcept | |
linked_list class constructor | |
linked_list (const linked_list &l) | |
copy constructor for the linked_list class | |
linked_list & | operator= (const linked_list &l) |
operator = for linked list class | |
bool | empty () |
empty function. Returns true if the list is empty. | |
size_t | size () |
size function. Returns the size of the list. | |
Iterator | begin () |
pointer that points to begin | |
Iterator | end () |
pointer that points to end | |
void | push_back (T key) |
push_back function. | |
void | push_front (T key) |
push_front function. | |
void | erase (T key) |
erase function. | |
bool | search (T key) |
search function. | |
std::vector< T > | elements () |
elements function. | |
void | reverse () |
reverse function. | |
void | visualize () |
visualize function returns a .dot file that can be previewd with graphviz plugin in vscode | |
Friends | |
std::ostream & | operator<< (std::ostream &out, linked_list< T > &l1) |
<< operator for the linked_list class. | |
single linked list class
|
inlineexplicitnoexcept |
linked_list class constructor
__elements | you can provide the constructor with a vector of elements so you dont have to do multiple push backs yourself. |
|
inlineexplicit |
copy constructor for the linked_list class
l | the list we want to copy |
|
inline |
pointer that points to begin
std::vector< T > linked_list< T >::elements | ( | ) |
elements function.
|
inline |
pointer that points to end
void linked_list< T >::erase | ( | T | key | ) |
erase function.
key | the key to be erased. |
|
inline |
void linked_list< T >::push_back | ( | T | key | ) |
push_back function.
key | the key to be pushed back. |
void linked_list< T >::push_front | ( | T | key | ) |
push_front function.
key | the key to be pushed in front. |
bool linked_list< T >::search | ( | T | key | ) |
search function.
key | the key to be searched. |