https://github.com/saberglow/vector_class
Home made vector class in C++.
https://github.com/saberglow/vector_class
cpp dynamic-memory-allocation operator-overloading vector
Last synced: 8 months ago
JSON representation
Home made vector class in C++.
- Host: GitHub
- URL: https://github.com/saberglow/vector_class
- Owner: SABERGLOW
- License: mit
- Created: 2020-07-12T19:23:18.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-12T19:34:44.000Z (over 5 years ago)
- Last Synced: 2025-04-30T15:15:05.510Z (8 months ago)
- Topics: cpp, dynamic-memory-allocation, operator-overloading, vector
- Language: C++
- Homepage:
- Size: 5.86 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vector Class
Home made vector class in C++.
# Overview:
Vectors are a kind of sequence container. As such, their elements are ordered following a strict linear sequence. Vector containers are implemented as dynamic arrays; just as regular arrays, vector containers have their elements stored in contiguous storage locations, which means that their elements can be accessed not only using iterators but also using offsets on regular pointers to elements. But unlike regular arrays, storage in vectors is handled automatically, allowing it to be expanded and contracted as needed.
# Features:
Vectors are good at:
* Accessing individual elements by their position index (constant time).
* Iterating over the elements in any order (linear time).
* Add and remove elements from its end (constant amortized time).
_Compared to arrays, they provide almost the same performance for these tasks, plus they have the ability to be easily resized._
# Decomposition of the program:
* **Vector.h file:** class declaration header.
* **VectorSample.cpp:** the main program with testing code.
* **Vector.cpp:** implementation of class members declared in the header.