C++ STL Containers: Vector, Queue, Map, and Set Usage Patterns
Vector Cotnainer Operations
Vector Implementation Example:
#include<bits/stdc++.h>
using namespace std;
vector<string> locations;
vector<string> identifiers[1000];
int searchLocation(string target){
for(int idx=0; idx<locations.size(); idx++){
if(locations[idx] == target)
return idx;
}
retu ...
Posted on Wed, 17 Jun 2026 17:27:01 +0000 by AnthonyArde
Implementing a Custom Vector Class in C++
Vector Class Framework
The basic framework for our custom vector implementation inculdes three main pointers:
template<class T>
class vector
{
private:
iterator _start = nullptr; // Points to beginning of data
iterator _finish = nullptr; // Points to end of valid data
iterator _endOfStorage = nullptr; // Points to end of stora ...
Posted on Mon, 01 Jun 2026 01:36:51 +0000 by murali
Implementing a Vector Container in C++ and Understanding Iterator Invalidation
Vector Container Definition
In C++, a vector is a sequence container that encapsulates dynamic arrays. Its usage typically follows this pattern:
template<typename T>
class MyVector;
// Or in practice
std::vector<int> numbers;
Here, T represents the template parameter, which can be any built-in or user-defined type.
Initialization a ...
Posted on Sun, 17 May 2026 05:01:08 +0000 by adrianuk29