Skip to content

Implementation of all standard containers from the STL library

License

Notifications You must be signed in to change notification settings

sheritsh/s21_containers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

s21_containers

s21_containers

This project is part of the curriculum of School 21. As part of this project, we developed a standard C++ STL library from scratch, including sequential, associative, and derived containers. This educational project enhanced our team development skills, architecture design prior to implementation, taught us how to work with templates in C++, and solidified our object-oriented programming skills.

Russian version of README you can find here

Contents

  1. Contributors
  2. Getting started
    2.1. Prerequisites
    2.2. Steps to install and useful commands
  3. Technical specifications
  4. Test results
  5. The containers of the Standart Template Library(STL)

Contributors

Member Area of ​​responsibility
sheritsh_avatar
// sheritsh
vector
array
bradamar_avatar
// bradamar
deque
list
queue
stack
oznakban_avatar
// oznakban
AVLTree
set
map
melodiea_avatar
// melodiea
- Project and code supporting
- Developments on vector and list
- Test coverage

Getting Started

Prerequisites

Please install the following software before starting development:

Steps to install and useful commands

  • Clone repository
  • Run make - to build project and run tests
  • make check_style - to check source code for Google Style
  • make leaks / make valgrind - to check project for leaks and right memory access

If you wanna include 's21_containers.h' or 's21_containersplus.h' remember to use s21 namespace before containers.

Example:

s21::array<int, 5> arr = {1, 2, 3, 4, 5};

Technical specifications

  1. Programming Language and Compiler:
  • Implement the program in C++17.
  • Use the GCC compiler for compilation.
  1. Code Organization:
  • Organize the program code within the src folder.
  1. Coding Style:
  • Adhere to the Google coding style guidelines for consistency and readability.
  1. Namespace and Templates:
  • Implement classes within the s21 namespace.
  • Use template classes for container implementations to support different types.
  1. Container Classes:
  • Implement container classes: list, map, queue, set, stack, and vector.
  • Provide standard constructors (default, copy, move, with initialization list).
  • Implement methods for accessing, modifying, and managing container elements.
  • Include methods to check if a container is full or empty.
  1. Iterators:
  • Implement iterators for each container class.
  • Provide begin() and end() methods to access iterators.
  • Implement iterator operations: *iter, ++iter, --iter, iter1 == iter2, iter1 != iter2.
  1. Unit Testing:
  • Develop comprehensive unit tests using the GTest library.
  • Ensure test coverage for all container methods and edge cases.
  1. STL Logic and Exception Handling:
  • Follow the logic of the Standard Template Library (STL) for checks, memory handling, and behavior in abnormal situations.
  • Implement appropriate exception handling for error scenarios.
  1. s21_containers.h Library:
  • Implement the s21_containers.h header file.
  • Create separate header files (e.g., s21_list.h, s21_map.h) for each container class implementation.
  • Base the implementation on classical container paradigms, with flexibility in algorithm choices.
  1. Makefile:
  • Provide a Makefile to compile and test the library.
  • Include targets for cleaning (clean) and testing (test).
  1. s21_containersplus.h Library (Bonus):
  • Implement the s21_containersplus.h header file for additional container classes.
  • Include classes: array and multiset.
  • Base implementation on classical paradigms, allowing algorithm customization.
  1. Insert_many Method (Bonus):
  • Extend container classes with specified insert_many methods.
  • Implement the method variations for different containers as indicated in the table.
  • Support variable numbers of parameters using the parameter pack construct.
  1. Documentation and Comments:
  • Provide clear and concise code comments to explain the functionality and logic.
  • Include necessary documentation for container classes and methods.
  1. Testing and Validation:
  • Thoroughly test all implemented classes and methods for correctness and efficiency.
  • Include boundary tests and edge cases in the testing suite.
  1. Final Deliverables:
  • Submit the complete project, including source code, header files, Makefile, and test suite.

Test results

Using the Google Test Framework, all containers and their methods, including error handling, were covered with tests. This ensures comprehensive test coverage for the code and guarantees proper program behavior, including correct error handling. Excellent work in adopting such an approach!

test_results

The containers of the Standart Template Library

uml

About

Implementation of all standard containers from the STL library

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages