SUNphi
1.0
|
#include <Vector.hpp>
Public Types | |
using | Size = SignedOf< UnsignedSize > |
Signed version of the std::vector<T> size. | |
Public Member Functions | |
Size | size () const |
Returns the signed size. More... | |
Vector (const Vector &oth) | |
Copy constructor. | |
template<typename Arg , typename... Args, TypeIf<(not isSame< const Vector &, Arg >), void * > = nullptr> | |
Vector (Arg &&arg, Args &&...args) | |
Forward constructor to std::vector. | |
Vector () | |
Default constructor. | |
Vector (std::initializer_list< T > il) | |
Forward constrcution by initializing list. | |
T | summatorial (const UnsignedSize beg, const UnsignedSize end) const |
Computes the sum of all elements between [beg:end) More... | |
T | summatorial (const UnsignedSize beg=0) const |
T | productorial (const UnsignedSize beg, const UnsignedSize end) const |
Computes the product of all elements between [beg:end) More... | |
T | productorial (const UnsignedSize beg=0) const |
template<bool falseTrue, typename C , typename A > | |
Size | loopUntil (const Size first, const Size last, C cond, A act) const |
Action to perform. More... | |
template<typename C > | |
Size | findFirstWhereNot (C cond) const |
Finds the first element where the condition is false. More... | |
template<typename C > | |
Size | findLastWhereNot (C cond) const |
Finds the last element where the condition is false. More... | |
Size | findFirst (const T &val) const |
Finds the first element val . More... | |
Size | findFirstDiffFrom (const T &val) const |
Finds the first element different from val . More... | |
Size | findLast (const T &val) const |
Finds the last element val . More... | |
Size | findLastDiffFrom (const T &val) const |
Finds the last element different from val . More... | |
bool | isContained (const T &val) const |
Check if the value is contained. | |
auto | scopePushBack (const T &val) |
Push back a value and pop it back when going out of scope. | |
std::string | getStr () const |
Gets a string of form {1,2,3...}. More... | |
std::map< T, T > | group () const |
template<typename TOut > | |
void | divWithMod (Vector< TOut > "ient, Vector< TOut > &remainder, const Vector &divisor) const |
Returns the result and remainder of the division. More... | |
Static Public Member Functions | |
static auto | getNullAction () |
Null action. | |
static auto | getTrueCondition () |
True condition. | |
template<typename F > | |
static auto | getActer (F f) |
Returns an operator acting on a given element. | |
template<bool Ret = true> | |
static auto | getComparer (const T &val) |
Returns an operator comparing and returning Ret when occurring, !Ret if not. More... | |
Public Attributes | |
T | elements |
STL member. | |
Private Types | |
using | UnsignedSize = typename std::vector< T >::size_type |
Type of the data returned by std::vector. | |
Class wrapping std::vector
Fix some some idiosinchrasy, such as the unsigned returned value of size, and adds some useful method
Definition at line 29 of file Vector.hpp.
|
inline |
Returns the result and remainder of the division.
quotient | Result of the division |
remainder | Remainder of the division |
divisor | Divisor to be used |
Definition at line 310 of file Vector.hpp.
|
inline |
Finds the first element val
.
val | Element to find |
Definition at line 214 of file Vector.hpp.
|
inline |
Finds the first element different from val
.
val | Element to find |
Definition at line 222 of file Vector.hpp.
|
inline |
Finds the first element where the condition is false.
cond | Condition to check |
Definition at line 197 of file Vector.hpp.
|
inline |
Finds the last element val
.
val | Element to find |
Definition at line 230 of file Vector.hpp.
|
inline |
Finds the last element different from val
.
val | Element to find |
Definition at line 238 of file Vector.hpp.
|
inline |
Finds the last element where the condition is false.
cond | Condition to check |
Definition at line 206 of file Vector.hpp.
|
inlinestatic |
Returns an operator comparing and returning Ret when occurring, !Ret if not.
val | Value to compare |
Definition at line 148 of file Vector.hpp.
|
inline |
Gets a string of form {1,2,3...}.
Generator of the string
Definition at line 263 of file Vector.hpp.
|
inline |
Group the vector returning a map
Example
Result containing grouped factors
Definition at line 295 of file Vector.hpp.
|
inline |
Action to perform.
Perform the action all elements starting from first up to last (excluded) or until the condition is true or false
Returns the last position where the condition was true, or the past-beyond delimiter if never occurred
Offset to move
Position
first | First element to loop on |
last | Last excluded element to loop on |
cond | Condition function |
act | Action to perform |
Definition at line 169 of file Vector.hpp.
|
inline |
Computes the product of all elements between [beg:end)
beg | Begin |
end | End |
Definition at line 102 of file Vector.hpp.
|
inline |
Computes the product of all elements between [beg:end)
Case in which one only or no extreme is provided
beg | Begin |
Definition at line 113 of file Vector.hpp.
|
inline |
Returns the signed size.
Gets the unsigned size
Converts to sign
Definition at line 43 of file Vector.hpp.
|
inline |
Computes the sum of all elements between [beg:end)
beg | Begin |
end | End |
Definition at line 83 of file Vector.hpp.
|
inline |
Computes the sum of all elements between [beg:end)
Case in which one only or no extreme is provided
beg | Begin |
Definition at line 94 of file Vector.hpp.