NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
Vector< T > Class Template Reference

A vector. More...

#include <vector.h>

Inheritance diagram for Vector< T >:

Public Member Functions

auto argmin () const
 Argmin function returns the index of the smallest element in the vector.
 
auto argmax () const
 Argmax function returns the index of the largest element in the vector.
 
void sort ()
 Sort function sorts the elements in the vector in ascending order.
 
min () const
 min function returns the smalled element in the vector
 
max () const
 max function returns the largest element in the vector
 
sum () const
 Sum function returns the sum of all elements in the vector.
 
int index (const T &element) const
 get the index of an element in the vector
 
bool exist (const T &element) const
 check if the element exists in the vector
 
bool hasCommonElement (const Vector< T > &other) const
 check if the other vector contains any value in the current vector
 
bool isSubsetOf (const Vector< T > &other) const
 check if the other vector is a subset of the current vector
 
void insertToEnd (const std::vector< T > &other_vector)
 insert another vector to the end of this vector
 
bool removeValue (const T &value)
 Removes the value described by value.
 
std::string toString () const
 Convert this object into a string representation.
 
std::string toNotFormattedString () const
 

Detailed Description

template<typename T>
class Vector< T >

A vector.

Author
Ahmed Aredah
Date
2/28/2023
Template Parameters
TGeneric type parameter.

Member Function Documentation

◆ argmax()

template<typename T >
auto Vector< T >::argmax ( ) const
inline

Argmax function returns the index of the largest element in the vector.

Author
Ahmed Aredah
Date
2/28/2023
Returns
An auto.

◆ argmin()

template<typename T >
auto Vector< T >::argmin ( ) const
inline

Argmin function returns the index of the smallest element in the vector.

Author
Ahmed Aredah
Date
2/28/2023
Returns
An auto.

◆ exist()

template<typename T >
bool Vector< T >::exist ( const T &  element) const
inline

check if the element exists in the vector

Author
Ahmed Aredah
Date
2/28/2023
Parameters
elementThe element.
Returns
True if it succeeds, false if it fails.

◆ hasCommonElement()

template<typename T >
bool Vector< T >::hasCommonElement ( const Vector< T > &  other) const
inline

check if the other vector contains any value in the current vector

Parameters
other
Returns

◆ index()

template<typename T >
int Vector< T >::index ( const T &  element) const
inline

get the index of an element in the vector

Author
Ahmed Aredah
Date
2/28/2023
Parameters
elementThe element.

◆ insertToEnd()

template<typename T >
void Vector< T >::insertToEnd ( const std::vector< T > &  other_vector)
inline

insert another vector to the end of this vector

Author
Ahmed Aredah
Date
2/28/2023
Parameters
other_vectorThe other vector.

◆ isSubsetOf()

template<typename T >
bool Vector< T >::isSubsetOf ( const Vector< T > &  other) const
inline

check if the other vector is a subset of the current vector

Parameters
other
Returns

◆ max()

template<typename T >
T Vector< T >::max ( ) const
inline

max function returns the largest element in the vector

Author
Ahmed Aredah
Date
2/28/2023
Returns
The maximum value.

◆ min()

template<typename T >
T Vector< T >::min ( ) const
inline

min function returns the smalled element in the vector

Author
Ahmed Aredah
Date
2/28/2023
Returns
The minimum value.

◆ removeValue()

template<typename T >
bool Vector< T >::removeValue ( const T &  value)
inline

Removes the value described by value.

Author
Ahmed Aredah
Date
2/28/2023
Parameters
valueThe value.
Returns
True if it succeeds, false if it fails.

◆ sort()

template<typename T >
void Vector< T >::sort ( )
inline

Sort function sorts the elements in the vector in ascending order.

Author
Ahmed Aredah
Date
2/28/2023

◆ sum()

template<typename T >
T Vector< T >::sum ( ) const
inline

Sum function returns the sum of all elements in the vector.

Author
Ahmed Aredah
Date
2/28/2023
Returns
A T.

◆ toNotFormattedString()

template<typename T >
std::string Vector< T >::toNotFormattedString ( ) const
inline

◆ toString()

template<typename T >
std::string Vector< T >::toString ( ) const
inline

Convert this object into a string representation.

Author
Ahmed Aredah
Date
2/28/2023
Returns
A std::string that represents this object.