46#include <initializer_list>
63 T :: iterator
begin() {
return this->values.begin(); }
64 T :: iterator
end() {
return this->values.end(); }
65 T :: const_iterator
begin()
const {
return this->values.begin(); }
66 T :: const_iterator
end()
const {
return this->values.end(); }
85 inline IntArray &operator = (std :: initializer_list< int >list) {
values = list;
return *
this; }
106 inline int at(
int i)
const
119 inline int &operator() (
int i) {
return this->
operator[](i); }
120 inline int &operator[] (
int i)
133 inline const int &operator() (
int i)
const {
return this->
operator[](i); }
134 inline const int &operator[] (
int i)
const
152 }
else if ( i > this->
giveSize() ) {
174 void clear() { this->values.clear(); }
351 friend std :: ostream &operator << ( std :: ostream & out,
const IntArray & x );
355template<
class operation >
int
358 int i = l - 1, j = r;
363 while ( ( op(arry.
at(++i), v) ) < 0 ) {
367 while ( ( op( v, arry.
at(--j) ) ) < 0 ) {
378 arry.
at(i) = arry.
at(j);
383 arry.
at(i) = arry.
at(r);
390template<
class operation >
void quickSort(
IntArray &arry,
int l,
int r, operation op)
409template<
class operation >
void sort(
IntArray &arry, operation op) {
quickSort(arry, 1, arry.giveSize(), op); }
void printYourselfToFile(const std::string filename, const bool showDimensions=true) const
const int * givePointer() const
void findNonzeros(const IntArray &logical)
bool containsOnlyZeroes() const
IntArray(std ::initializer_list< int >list)
Initializer list constructor.
IntArray(const IntArray &src)
Copy constructor. Creates the array from another array.
void enumerate(int maxVal)
IntArray(int n=0)
Constructor for sized array. Data is zeroed.
bool containsSorted(int value) const
int findSorted(int value) const
void printYourself() const
Prints receiver on stdout.
int findFirstIndexOf(int value) const
void resizeWithValues(int n, int allocChunk=0)
void preallocate(int futureSize)
int givePackSize(DataStream &buff) const
contextIOResultType storeYourself(DataStream &stream) const
T::const_iterator end() const
contextIOResultType restoreYourself(DataStream &stream)
void zero()
Sets all component to zero.
bool insertSortedOnce(int value, int allocChunk=0)
void insertSorted(int value, int allocChunk=0)
~IntArray()=default
Destructor.
void followedBy(int b, int allocChunk=0)
void checkBounds(int i) const
void printYourself(const std::string name) const
void pY() const
Abbreviation for printYourself().
int findCommonValuesSorted(const IntArray &iarray, IntArray &common, int allocChunk=0) const
void followedBy(const IntArray &b, int allocChunk=0)
bool contains(int value) const
bool isAllFinite() const
Returns true if no element is NAN or infinite.
void eraseSorted(int value)
T::const_iterator begin() const
IntArray(IntArray &&src)
Move constructor. Creates the array from another array.
std::vector< int > values
Stored values.
void quickSort(IntArray &arry, int l, int r, operation op)
int quickSortPartition(IntArray &arry, int l, int r, operation op)
void sort(IntArray &arry, operation op)