A modern, extensible, and type-safe C++ library for linked list data structures
The Generalised Data Structures Library is a header-only, modern C++ library providing robust, reusable, and efficient implementations of linked list data structures.
It is designed for both educational and production use, with a focus on type safety, exception safety, and extensibility.
- Singly Linked List (
SinglyLinkedList<T>
) - Doubly Linked List (
DoublyLinkedList<T>
) - Singly Circular Linked List (
SinglyCircularList<T>
) - Doubly Circular Linked List (
DoublyCircularList<T>
) - Fully templated and type-safe
- Exception-safe operations
- Consistent, intuitive API
- Header-only: easy integration
- Well-documented and tested
- Modern C++17 codebase
include/
DataStructures.hpp
SinglyLinkedList.hpp
DoublyLinkedList.hpp
SinglyCircularList.hpp
DoublyCircularList.hpp
src/
main.cpp
tests/
test_linkedlists.cpp
docs/
logo.png
demo.gif
CMakeLists.txt
README.md
.gitignore
LICENSE
- C++17 compatible compiler (e.g., GCC 7+, Clang 5+, MSVC 2017+)
- CMake 3.10 or newer
git clone https://github.com/yourusername/Generalised-Data-Structures-Library-.git
cd Generalised-Data-Structures-Library-
mkdir build && cd build
cmake ..
make
./main
#include "DataStructures.hpp"
using namespace gds;
int main() {
SinglyLinkedList<int> sll;
sll.insertFirst(10);
sll.insertLast(20);
sll.display();
DoublyLinkedList<char> dll;
dll.insertFirst('A');
dll.insertLast('B');
dll.display();
SinglyCircularList<int> scl;
scl.insertFirst(1);
scl.insertLast(2);
scl.display();
DoublyCircularList<char> dcl;
dcl.insertFirst('X');
dcl.insertLast('Y');
dcl.display();
return 0;
}
All list types support:
Method | Description |
---|---|
insertFirst(const T& value) |
Insert at the beginning |
insertLast(const T& value) |
Insert at the end |
insertAtPos(const T& value, size_t p) |
Insert at position (1-based) |
deleteFirst() |
Remove the first element |
deleteLast() |
Remove the last element |
deleteAtPos(size_t pos) |
Remove element at position |
display(std::ostream& os = std::cout) |
Print the list to the output stream |
size() const |
Get the number of elements |
All operations throw std::out_of_range
on invalid positions or empty lists.
Unit tests are located in the tests/
directory.
To run tests (if provided):
cd build
ctest
Contributions are welcome! Please open issues or pull requests for improvements, bug fixes, or new features.
- Fork the repository
- Create your feature branch (
git checkout -b feature/YourFeature
) - Commit your changes (
git commit -am 'Add new feature'
) - Push to the branch (
git push origin feature/YourFeature
) - Open a pull request
This project is licensed under the MIT License.
Maintainer: Abhishek Atole
For questions or support, please open an issue or contact via GitHub.