C++ Custom Vector Template Class

Overview

C++ Custom Vector Template Class

This is an implementation of a template class for storing data in any type. It includes user-friendly interface with lots of helper abstract functions and also custom iterators.

Member Functions

Function Name Parameters Return Type Description
add T element void Adds given element to end of current vector
clear void Clears the vector
count T element int Returns total count of the element
first T Returns first element in the vector
firstIndexOf T element int Returns first index of the element in the vector
getCapacity int Returns capacity of the vector
getSize int Returns size of the vector
insert T element, int index void Inserts given element to a specific index
includes T element bool Returns if the element exists in the vector
isEmpty bool Returns if the vector is empty
last T Returns last element in the vector
lastIndexOf T element int Returns last index of the element in the vector
pop T element Returns first element in the vector and removes it from the vector
push T element void Inserts the element in first index of the vector
select bool (T) CustomVector Returns a sub-vector with elements in the vector which returns true for given lambda function
sort void Sorts the vector
sort bool(T,T) void Sorts the vector according to the given lambda function
subArray int start,int end CustomVector Returns a sub-vector between given indexes
swap int index1, int index2 void Swaps elements in the given indexes
remove T element void Removes all occurances of the element from the vector
removeIf bool(T) void Removes all elements from the vector which return false from given lambda function
removeIndex int index void Removes the element in the given index
removeRange int start, int end void Removes all elements in the given range of indexes
reverse void Reverses order of the vector

Overloaded Operators

Operator Parameters Return Type Description
<< std::ostream stream, CustomVector element std::ostream Inserts elements of the vector to stream via stream insertion operator
+ CustomVector vector,CustomVector other CustomVector Concats elements of two vectors
- CustomVector vector,CustomVector other CustomVector Removes elements of second vector from first vector
^ CustomVector vector,CustomVector other CustomVector Returns an vector which includes intersection of two vectors
== CustomVector vector,CustomVector other bool Returns if two vectors are equal
!= CustomVector vector,CustomVector other bool Returns if two vectors are not equal
[] int index T Returns element in given index
[] {int index1,int index2} CustomVector Returns an sub-vector which includes elements between two indexes

Iterators

This template class comes with its own iterators here and they are all compitable with STL functions such as std::find, std::sort

Function Name Description
begin Returns an iterator which points to start of the vector
end Returns an iterator which points to start of the vector
cbegin Returns an const iterator which points to start of the vector
cend Returns an const iterator which points to start of the vector

Important Note

To use some of listed functions and overloaded operators given T type must support these operations

You might also like...
The PULP Ara is a 64-bit Vector Unit, compatible with the RISC-V Vector Extension Version 0.9, working as a coprocessor to CORE-V's CVA6 core

Ara Ara is a vector unit working as a coprocessor for the CVA6 core. It supports the RISC-V Vector Extension, version 0.9. Dependencies Check DEPENDEN

VexCL is a C++ vector expression template library for OpenCL/CUDA/OpenMP

VexCL VexCL is a vector expression template library for OpenCL/CUDA. It has been created for ease of GPGPU development with C++. VexCL strives to redu

A library to serialize custom classes to and from XML by adding a very minimal amount of code to a class.

ai-xml submodule This repository is a git submodule providing a C++ framework for serializing classes to and from XML with a minimal amount of code pe

Create a working USB CDC class starting from the clear template provided by ST

STM32F3 USB Classes from template The goal of this project is to provide a decent collection of guidelines for creating working USB classes to be used

A C++ Class and Template Library for Performance Critical Applications

Spirick Tuning A C++ Class and Template Library for Performance Critical Applications Optimized for Performance The Spirick Tuning library provides a

Blitz++ is a C++ template class library which provides array objects for scientific computing

Blitz++ is a C++ template class library which provides array objects for scientific computing

Strong typedef - A class template that creates a new type that is distinct from the underlying type, but convertible to and from it

jss::strong_typedef Tag, ValueType, Properties... This is an implementation of a C++17 class template that provides a wrapper type that is convertib

Opt - Class template designed to express optionality without having to sacrifice memory to store additional bool flag

mp::optT, Policy mp::optT, Policy is a class template designed to express optionality. It has interface similar to std::optionalT (see here) but

Code::Blocks template for custom launcher executable.

Launcher Code::Blocks template for custom launcher executables. This is a basic Code::Blocks project for creating authentic Windows executables. Inclu

This is a C plus plus coding template for Compitative programming. This template is very optimized for the Online Judgment

C-plusplus-compitative-Programming-Template Tech We Used C++ Features Easy to compile Easy debug facility Analysised and optimized base template Steps

FSD-Template - A template UE4.25 project for BP modding.

FSD-Template Project generated by Archengius' UE4 Template Generator. Reflected C++ classes generated by CheatingMuppet & Archengius' UE4SS UHT Genera

OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.
OpenGL Template Engine - a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects.

OpenGL Template Engine is a C++ OpenGL graphics engine which aimed to be a simple startup template for 3D OpenGL projects. This is the template I personally use for my own projects and provides me with the general OpenGL 3D render setup with model import and UI.

2D Vector Graphics Engine Powered by a JIT Compiler

Blend2D 2D Vector Graphics Powered by a JIT Compiler. Official Home Page (blend2d.com) Official Repository (blend2d/blend2d) Public Chat Channel Zlib

Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.
Antialiased 2D vector drawing library on top of OpenGL for UI and visualizations.

This project is not actively maintained. NanoVG NanoVG is small antialiased vector graphics rendering library for OpenGL. It has lean API modeled afte

libsvm websitelibsvm - A simple, easy-to-use, efficient library for Support Vector Machines. [BSD-3-Clause] website

Libsvm is a simple, easy-to-use, and efficient software for SVM classification and regression. It solves C-SVM classification, nu-SVM classification,

linalg.h is a single header, public domain, short vector math library for C++

linalg.h linalg.h is a single header, public domain, short vector math library for C++. It is inspired by the syntax of popular shading and compute la

SIMD Vector Classes for C++

You may be interested in switching to std-simd. Features present in Vc 1.4 and not present in std-simd will eventually turn into Vc 2.0, which then de

An implementation of a weak handle interface to a packed vector in C++

Experimental handle container in C++ Overview Following on from c-handle-container, this library builds on the same ideas but supports a dynamic numbe

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL

Mapbox GL Native A C++ library that powers customizable vector maps in native applications on multiple platforms by taking stylesheets that conform to

Owner
Ozan Armağan
Ozan Armağan
Benchmarking a trivial replacement for std::vector

std::vector replacement benchmark Dependencies You'll need gnuplot and bash to run ./bench.sh. In addition to that, you'll need to have gcc and clang

Dale Weiler 9 Aug 27, 2022
Public repository for rolling release of main Vector robot code repository.

vector Public repository for rolling release of main Vector robot code repository. This rolling release will be worked to completion until all non-thi

Digital Dream Labs 63 Dec 19, 2022
Class containing Anti-RE, Anti-Debug and Anti-Hook methods. Made for C++/CLI

Umium Class containing Anti-RE, Anti-Debug and Anti-Hook methods. Easy to use and easy to implement. Disclaimer This code has been made and optimized

null 59 Dec 23, 2022
C++20 N-dimensional Matrix class for hobby project

Ndim-Matrix C++20 N-dimensional Matrix class for hobby project Supporting matrix operations STL compatible iterators reshape (O(1) move operation, no

null 20 Jul 27, 2022
Custom Malloc/Free implementation in C

To run the tests simply compile using "make" and run the executable "memory" with "./memory". The tests run automatically from main(), there are 3 tes

null 1 Dec 30, 2021
C header library for typed lists (using macros and "template" C).

vector.h C header library for typed lists (using macros and "template" C). Essentially, this is a resizable array of elements of your choosing that is

Christopher Swenson 33 Dec 19, 2022
Golang template grammar for tree-sitter

tree-sitter-go-template Golang templates grammar for tree-sitter. NeoVim integration using nvim-treesitter Add gotmpl parser following nvim-treesitter

Nikita Galaiko 28 Nov 30, 2022
STX B+ Tree C++ Template Classes

STX B+ Tree C++ Template Classes v0.9 Author: Timo Bingmann (Mail: tb a-with-circle panthema dot net) Date: 2013-05-05 The STX B+ Tree package is obso

Timo Bingmann 198 Dec 21, 2022
A custom,multifunctional class template for arrays which supports lambda functions for removing and selecting

C++ Array Template Class This is an implementation of a template class for storing data in any type.It includes user-friendly interface with lots of h

Ozan Armağan 2 Dec 8, 2021
This API uses both composition and inheritance to provide a generic way to set up a custom server with a custom communication protocol and custom middlewares

Ziapi Summary Introduction Installation Introduction This API uses both composition and inheritance to provide a generic way to set up a custom server

Aurélien Boch 8 Apr 22, 2022