Static Public Member Functions | List of all members
Vectors Struct Referencefinal

Utilities for vectors. More...

#include <Vectors.hpp>

Static Public Member Functions

template<typename T >
static void append (std::vector< T > &dst, const std::vector< T > &src)
 Appends the source vector to the destination vector. More...
 
static std::string charsToString (const std::vector< char > &vector)
 Convert the characters in the supplied char vector to a UTF-8. More...
 
static std::u16string charsToString (const std::vector< char16_t > &vector)
 Convert the characters in the supplied char16_t vector to a UTF-16. More...
 
static std::u32string charsToString (const std::vector< char32_t > &vector)
 Convert the characters in the supplied char32_t vector to a UTF-32. More...
 
template<typename D , typename S >
static std::vector< D > map (const std::vector< S > &input, std::function< D(const S &)> f)
 Perform a map operator from one vector to another (transform the input elements to a vector of different elements). More...
 
template<typename T >
static void move (std::vector< T > &dst, const std::vector< T > &src)
 Moves the source vector into the destination vector. More...
 
template<typename T , typename ... PT>
static void pushBack (std::vector< T > &vector, T &&first, PT &&... remaining)
 Populate an existing vector via emplace back of multiple elements. More...
 
template<typename T >
static void pushBack (std::vector< T > &)
 Populate an existing vector via emplace back of multiple elements (end case). More...
 
template<typename T , typename ... PT>
static std::vector< T > pushBack (T &&first, PT &&... remaining)
 Create and populate a vector via emplace back of multiple elements. More...
 
template<typename T >
static std::vector< T > pushBack ()
 Create and populate a vector via emplace back of multiple elements (empty case). More...
 
template<typename T , typename T2 , typename Compare = std::equal_to<T>, typename Replace = std::function<void (T &, T2 &&)>>
static void pushBackOrReplace (std::vector< T > &dst, T2 &&element, Compare compare=std::equal_to< T >(), Replace replace=DefaultReplace< T, T2 >())
 Appends the supplied element to the vector or replaces an existing element if a matching one is found. More...
 
static std::vector< char > toCharVector (const std::string &str)
 Convert the supplied UTF-8 string to a char vector. More...
 
static std::vector< char32_t > toCharVector (const std::u32string &str)
 Convert the supplied UTF-32 string to a char32_t vector. More...
 
template<typename T >
static std::vector< std::u32string > toString32Vector (const std::vector< T > &vector)
 Convert the supplied vector to a vector of UTF-32 strings. More...
 
template<typename T >
static std::vector< std::string > toStringVector (const std::vector< T > &vector)
 Convert the supplied vector to a vector of UTF-8 strings. More...
 

Detailed Description

Utilities for vectors.

Member Function Documentation

◆ append()

static void append ( std::vector< T > &  dst,
const std::vector< T > &  src 
)
inlinestatic

Appends the source vector to the destination vector.

◆ charsToString() [1/3]

static std::string charsToString ( const std::vector< char > &  vector)
inlinestatic

Convert the characters in the supplied char vector to a UTF-8.

◆ charsToString() [2/3]

static std::u16string charsToString ( const std::vector< char16_t > &  vector)
inlinestatic

Convert the characters in the supplied char16_t vector to a UTF-16.

◆ charsToString() [3/3]

static std::u32string charsToString ( const std::vector< char32_t > &  vector)
inlinestatic

Convert the characters in the supplied char32_t vector to a UTF-32.

◆ map()

static std::vector<D> map ( const std::vector< S > &  input,
std::function< D(const S &)>  f 
)
inlinestatic

Perform a map operator from one vector to another (transform the input elements to a vector of different elements).

◆ move()

static void move ( std::vector< T > &  dst,
const std::vector< T > &  src 
)
inlinestatic

Moves the source vector into the destination vector.

◆ pushBack() [1/4]

static void pushBack ( std::vector< T > &  vector,
T &&  first,
PT &&...  remaining 
)
inlinestatic

Populate an existing vector via emplace back of multiple elements.

Given a variadic set of input arguments, call emplace_back on each element.

◆ pushBack() [2/4]

static void pushBack ( std::vector< T > &  )
inlinestatic

Populate an existing vector via emplace back of multiple elements (end case).

Given no variadic input arguments, do nothing.

◆ pushBack() [3/4]

static std::vector<T> pushBack ( T &&  first,
PT &&...  remaining 
)
inlinestatic

Create and populate a vector via emplace back of multiple elements.

Given a variadic set of input arguments, call emplace_back on each element.

◆ pushBack() [4/4]

static std::vector<T> pushBack ( )
inlinestatic

Create and populate a vector via emplace back of multiple elements (empty case).

Given a variadic set of input arguments, call emplace_back on each element.

◆ pushBackOrReplace()

static void pushBackOrReplace ( std::vector< T > &  dst,
T2 &&  element,
Compare  compare = std::equal_to<T>(),
Replace  replace = DefaultReplace<T, T2>() 
)
inlinestatic

Appends the supplied element to the vector or replaces an existing element if a matching one is found.

The supplied comparator is used to compare values (defaults to std::equal_to).

The supplied replace function is used to assign the supplied value to the existing one when a matching value is is found (defaults to operator =).

The data is copied or moved into the new or existing value depending on the typename.

◆ toCharVector() [1/2]

static std::vector<char> toCharVector ( const std::string &  str)
inlinestatic

Convert the supplied UTF-8 string to a char vector.

◆ toCharVector() [2/2]

static std::vector<char32_t> toCharVector ( const std::u32string &  str)
inlinestatic

Convert the supplied UTF-32 string to a char32_t vector.

◆ toString32Vector()

static std::vector<std::u32string> toString32Vector ( const std::vector< T > &  vector)
inlinestatic

Convert the supplied vector to a vector of UTF-32 strings.

◆ toStringVector()

static std::vector<std::string> toStringVector ( const std::vector< T > &  vector)
inlinestatic

Convert the supplied vector to a vector of UTF-8 strings.


The documentation for this struct was generated from the following file: