Brief Overview on Linked List
This documentation is written in a way to introduce the idea of a linked list
 
Loading...
Searching...
No Matches
linked_list.hpp
Go to the documentation of this file.
1
5#ifndef LINKED_LIST_HPP
6#define LINKED_LIST_HPP
7
8#include "node.hpp"
9#include <vector>
10#include <ostream>
11
16 public:
21 Linked_list();
29 Linked_list( std::vector<int> lst_values );
34 ~Linked_list();
49 double front() const;
73 bool empty() const;
93 void push_front( int new_value );
115 void pop_front();
133 void clear();
134
135
136 private:
140 friend std::ostream &operator<<( std::ostream& out, Linked_list const& lst );
144 Node* head_;
145};
161std::ostream &operator<<( std::ostream& out, Linked_list const& lst );
162#endif
Linked List Class with Methods and Properties.
Definition linked_list.hpp:15
void pop_front()
Method will remove the current head node and replace it with the next node in the list,...
Definition linked_list.cpp:49
bool empty() const
Method will return a boolean value indicating if the linked list is empty.
Definition linked_list.cpp:41
Linked_list()
Constructor Creates an new empty Linked List object.
Definition linked_list.cpp:10
~Linked_list()
Destructor Removes all the nodes stored in the Linked list when the Linked List object is terminated.
Definition linked_list.cpp:27
double front() const
Method will return the value stored in the node at the front of the linked list (head node) if not em...
Definition linked_list.cpp:33
friend std::ostream & operator<<(std::ostream &out, Linked_list const &lst)
Allows this function to access the private member variables.
Definition linked_list.cpp:64
void clear()
Method will clear all the nodes in the linked list, leaving an empty linked list object.
Definition linked_list.cpp:58
void push_front(int new_value)
Method will create a new node with the assigned value and placed it at the front of linked list.
Definition linked_list.cpp:45
Node Properties and Methods for the Linked List.
Definition node.hpp:10
std::ostream & operator<<(std::ostream &out, Linked_list const &lst)
Operator Overloading to be able to format the memebers of a linked list in a personalized view.
Definition linked_list.cpp:64
C++ header file that declares all the methods and properties of a node for a linked list.