This project demonstrates different stack implementations in C++ using object-oriented programming and templates. The directory structure is organized as follows:
.
├── include/ # Header files and templates
│ ├── index.h
│ ├── class/stack/ # Stack class definitions
│ │ ├── node.h
│ │ ├── stack-dynamic.h
│ │ ├── stack-linked.h
│ │ ├── stack-vector.h
│ │ └── index.h
│ ├── interface/stack.h # Stack interface (abstract base class)
│ └── templates/ # Template implementations
│ ├── node.tpp
│ ├── stack-dynamic.tpp
│ ├── stack-linked.tpp
│ └── stack-vector.tpp
├── src/
│ └── main.cpp # Entry point for the project
├── build/ # Compiled output files (created by Makefile)
├── Makefile # Build automation
├── Benchmark.md # Benchmark results and analysis
└── README.md # Project documentation
-
Stack Implementations:
StackVec: Stack using STLvectorStackLinked: Stack using a linked list ofNodeobjectsStackDynamic: Stack using a dynamically resizing array
-
Interface:
All stack classes implement the commonStackinterface.
This project uses a Makefile for building and running the code.
To compile the project, run:
make compileThis will compile all source files and place the output in the build/ directory.
To run the compiled executable:
make runThis will execute the binary located at build/main.
You can also compile and run the project in a single command:
makeTo remove all compiled files and the build/ directory:
make cleanFor more details on benchmarks and implementation, see Benchmark.md.