Array
Public Member Functions | Static Public Member Functions | Friends | List of all members
evt::Array< Type > Class Template Reference

Public Member Functions

 Array (const int initialCapacity)
 
 Array (const SizeType initialCapacity)
 
 Array (InitializerList &&elements, SizeType initialCapacity=2)
 
 Array (const Array &otherArray, SizeType initialCapacity=2)
 
 Array (Array &&otherArray, SizeType initialCapacity=2)
 
template<typename Container , typename = typename std::enable_if<!std::is_same<Container,Array>::value && !std::is_same<Container,Type>::value>::type>
 Array (Container &&elements, SizeType initialCapacity=2)
 
SizeType size () const
 
SizeType count () const
 
SizeType capacity () const
 
bool isEmpty () const
 
void insertAt (const Type *position, const Type &newElement)
 
void insertAt (const Type *position, Type &&newElement)
 
void insert (const Type &newElement, const SizeType index, const SizeType capacityResizeFactor=2)
 
void insert (Type &&newElement, const SizeType index, const SizeType capacityResizeFactor=2)
 
void assignRange (SizeType first, SizeType last)
 Replaces the contents with copies of those in the range.
 
CONSTEXPR void append (const Type &newElement, const SizeType capacityResizeFactor=2)
 
CONSTEXPR void append (Type &&newElement, const SizeType capacityResizeFactor=2)
 
void append (InitializerList &&newElements)
 
void appendElements (InitializerList &&newElements)
 
template<typename Container >
void appendElements (const Container &newElements)
 
template<typename Container >
void appendElements (Container &&newElements)
 
void reserve (const SizeType newSize)
 Only reserves new memory if the new size if bigger than the array capacity.
 
void resize (const SizeType newSize)
 Only reserves new memory if the new size if smaller than the array count.
 
bool shrink ()
 Requests the removal of unused capacity. The new capacity will be the number of elements (count)
 
void clear ()
 Removes all elements in array, count will be 0, capacity won't be affected.
 
CONSTEXPR void removeAll (const bool keepCapacity=false)
 Removes all elements in array, capacity will be 1 if desired.
 
void removeAt (const SizeType index, const bool shrinkIfEmpty=true)
 
void removeLast (const bool shrinkIfEmpty=true)
 
void removeFirst (const bool shrinkIfEmpty=true)
 
void removeSubrange (const SizeType startPosition, const SizeType endPosition, bool lessEqual=true)
 
void removeSubrange (std::initializer_list< int > position, bool lessEqual=true)
 
void swap (Array &otherArray)
 
template<typename Container >
ArrayremoveElements (const Container &newElements, bool onlyFirstOcurrence=false)
 
ArrayremoveElements (InitializerList newElements, bool onlyFirstOcurrence=false)
 
template<typename Container >
void swap (Container &container)
 
bool contains (const Type &element) const
 
SizeType find (const Type &element) const
 Returns the index of the first ocurrence of the element. Last position if the element isn't found.
 
SizeType findIf (const std::function< bool(const Type &)> &findFunction) const
 
Array< SizeType > findAll (const Type &element) const
 Returns an Array with all the ocurrences of the element.
 
std::string toString () const
 
template<typename Container >
bool equal (const Container &elements) const
 
bool equal (InitializerList &&elements) const
 
Array filter (const std::function< bool(const Type &)> &filterFunction) const
 
SizeType countOf (const std::function< bool(const Type &)> &countOfFunction) const
 
SizeType countOf (const Type &value) const
 
Type & operator[] (const SizeType index)
 
const Type & operator[] (const SizeType index) const
 
template<typename Container >
Arrayoperator-= (const Container &newElements)
 Removes a subrange of elements.
 
Arrayoperator-= (InitializerList newElements)
 
template<typename Container >
Array operator- (const Container &newElements) const
 Returns a subrange of elements.
 
template<typename Container >
Array operator+ (const Container &newElements) const
 
template<typename Container >
Arrayoperator+= (const Container &newElements)
 
template<typename Container >
Arrayoperator+= (Container &&newElements)
 
Arrayoperator+= (InitializerList newElements)
 
template<typename Container >
bool operator== (const Container &elements) const
 
template<typename Container >
bool operator!= (const Container &elements) const
 
template<typename Container >
bool operator< (const Container &elements)
 Returns true if the contents of the array are lexicographically less than the contents of the container.
 
template<typename Container >
bool operator<= (const Container &elements)
 
template<typename Container >
bool operator> (const Container &elements)
 Returns true if the contents of the array are lexicographically greater than the contents of the container.
 
template<typename Container >
bool operator>= (const Container &elements)
 
Arrayoperator= (const Array &otherArray)
 
Arrayoperator= (Array &&otherArray)
 
void moveFrom (Array &&otherArray)
 
void shuffle ()
 
Array shuffled () const
 
void sort (const std::function< bool(Type &, Type &)> &compareFunction=std::less_equal< Type >())
 
Array sorted (const std::function< bool(Type &, Type &)> &compareFunction=std::less_equal< Type >()) const
 
Type * begin () const
 
Type * end () const
 
Type & first ()
 
Type & last ()
 
const Type & first () const
 
const Type & last () const
 

Static Public Member Functions

template<typename Container >
static Container to (const Array &elements)
 Converts Array to other types.
 
template<typename Container >
static Container to (Array &&elements)
 

Friends

std::ostream & operator<< (std::ostream &os, const evt::Array< Type > &arr)
 Returns an ostream that contains the array elements.
 

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