PIP 5.6.1
Platform-Independent Primitives
Classes | Public Member Functions | List of all members
PIVector2D< T > Class Template Reference

2D array container.This class is used to store a 2D array of elements of any type as a single continuous block of memory (a plain PIVector). Elements can be accessed using the [][] operators, where the first index is the row and the second is the column. Rows can be manipulated as PIVector objects, allowing modification of individual elements or assignment of entire rows. You cannot directly add or remove elements to change the dimensions of the array after construction (use resize(), addRow(), removeRow(), removeColumn() instead), but you can modify the values of existing elements. More...

#include <pivector2d.h>

Classes

class  Col
 Proxy class representing a single column in a PIVector2D for modification. Objects of this class are returned by non-const col(). They provide column-wise access and operations similar to Row. More...
 
class  ColConst
 Proxy class representing a single read-only column in a PIVector2D. Returned by const col(). Provides const access to column elements. More...
 
struct  Index
 Index structure for 2D array elements (row, column). More...
 
class  Row
 Proxy class representing a single row in a PIVector2D for modification. Objects of this class are returned by non-const operator[] or row(). They provide array-like access to the elements of a specific row and allow operations such as assignment from another row or a PIVector, searching, filling, and iteration. More...
 
class  RowConst
 Proxy class representing a single read-only row in a PIVector2D. Returned by const operator[] or row(). Provides const access to row elements. More...
 

Public Member Functions

 PIVector2D ()
 Constructs an empty 2D array. No memory is allocated. After this constructor, rows() and cols() return 0, and isEmpty() returns true. More...
 
 PIVector2D (size_t rows, size_t cols, const T &f=T())
 Constructs a 2D array with the given dimensions, filled with copies of f. The underlying storage is a single contiguous block of memory of size rows * cols. All elements are initialized with the value f. More...
 
 PIVector2D (size_t rows, size_t cols, const PIVector< T > &v)
 Constructs a 2D array from an existing 1D vector, reshaping it. The constructor copies the data from v into the internal flat vector. If v is larger than rows * cols, the excess elements are ignored (the vector is truncated). If v is smaller, other values filled whith default cunstructor T() More...
 
 PIVector2D (size_t rows, size_t cols, PIVector< T > &&v)
 Move constructs a 2D array from an existing 1D vector, reshaping it. The data is moved from v into the internal flat vector, avoiding a copy. After construction, v is left in a valid but unspecified state. More...
 
 PIVector2D (const PIVector< PIVector< T > > &v)
 Constructs a 2D array from a vector of vectors (jagged array). Assumes all inner vectors have the same size. If the input is empty, the constructed array is also empty. Otherwise, the number of columns is taken from the size of the first inner vector. All inner vectors are concatenated in the internal flat storage.
 
size_t rows () const
 Returns the number of rows in the 2D array. The result is always non-negative. If the array is empty, returns 0. More...
 
size_t cols () const
 Returns the number of columns in the 2D array. The result is always non-negative. If the array is empty, returns 0. More...
 
size_t size () const
 Returns the total number of elements (rows * cols). This is equivalent to the size of the underlying flat vector. More...
 
ssize_t size_s () const
 Returns the total number of elements as a signed value. More...
 
size_t length () const
 Returns the total number of elements (same as size()). More...
 
size_t capacity () const
 Returns the number of elements that the underlying container has currently allocated space for. This value may be larger than size(). It indicates how many elements can be added before a reallocation is needed.
 
bool isEmpty () const
 Checks if the array has no elements. An empty array has both rows and columns equal to 0. More...
 
bool isNotEmpty () const
 Checks if the array has at least one element. More...
 
T & element (size_t row, size_t col)
 Returns a reference to the element at the given row and column. No bounds checking is performed. More...
 
const T & element (size_t row, size_t col) const
 Returns a const reference to the element at the given row and column.
 
const T & at (size_t row, size_t col) const
 Returns a const reference to the element at the given row and column No bounds checking is performed.
 
T & operator[] (const Index &idx)
 Returns a reference to the element at the given Index.
 
const T & operator[] (const Index &idx) const
 Returns a const reference to the element at the given Index.
 
T & element (const Index &idx)
 Returns a reference to the element at the given Index.
 
const T & element (const Index &idx) const
 Returns a const reference to the element at the given Index.
 
const T & at (const Index &idx) const
 Returns a const reference to the element at the given Index (bounds-checked only in debug).
 
Row operator[] (size_t index)
 Returns a proxy object for the row at the given index for modification. More...
 
RowConst operator[] (size_t index) const
 Returns a proxy object for the row at the given index for read-only access.
 
T * data (size_t index=0)
 Returns a pointer to the underlying flat data starting at an optional offset. More...
 
const T * data (size_t index=0) const
 Returns a const pointer to the underlying flat data starting at an optional offset.
 
Row row (size_t index)
 Returns a proxy object for the row at the given index for modification. More...
 
RowConst row (size_t index) const
 Returns a proxy object for the row at the given index for read-only access.
 
Col col (size_t index)
 Returns a proxy object for the column at the given index for modification. More...
 
ColConst col (size_t index) const
 Returns a proxy object for the column at the given index for read-only access.
 
PIVector2D< T > & setRow (size_t row, const RowConst &other)
 Replaces a row with the contents of a read-only RowConst object.
 
PIVector2D< T > & setRow (size_t row, const PIVector< T > &other)
 Replaces a row with the contents of a PIVector.
 
PIVector2D< T > & addRow (const RowConst &other)
 Appends a new row to the bottom of the array from another Row object. If the array was empty, its column count is set to the size of the source row. Otherwise, only min(cols(), other.size()) elements are copied; the rest of the new row is default-initialized. More...
 
PIVector2D< T > & addRow (const PIVector< T > &other)
 Appends a new row to the bottom of the array from a PIVector.
 
PIVector2D< T > & appendRows (size_t count, const T &f=T())
 Appends count new empty rows to the bottom of the array, filled with value f. If the array was empty (no columns defined), the column count is set to 1. The new rows are filled with the default value f. More...
 
PIVector2D< T > & appendColumns (size_t count, const T &f=T())
 Appends count new empty columns to the end of each row of the array. If the array was empty (rows not defined), the array becomes a single row with count columns. If the array already has rows, new elements are inserted at the end of each existing row. More...
 
PIVector2D< T > & deleteRows (size_t row_start, size_t count)
 Deletes count rows starting from the specified row index. Removes the specified rows from the array and updates the row count. If all elements are deleted (array becomes empty), both rows and columns are set to 0. More...
 
PIVector2D< T > & deleteColumns (size_t col_start, size_t count)
 Removes the specified columns from the array and updates the column count. Removes count columns starting from col_start. If col_start is out of range or count is 0, the function does nothing. If count extends beyond the last column, only available columns are deleted. More...
 
PIVector2D< T > & addColumn (const ColConst &other)
 Appends a new column to the right of the array from a ColConst.
 
PIVector2D< T > & addColumn (const PIVector< T > &other)
 Appends a new column to the right of the array from a PIVector.
 
PIVector2D< T > & resize (size_t rows, size_t cols, const T &f=T())
 Resizes the 2D array to new dimensions. If the new dimensions are larger, new elements are appended and filled with copies of f. If they are smaller, the array is truncated (excess elements are destroyed). The underlying memory may be reallocated. More...
 
bool operator== (const PIVector2D< T > &t) const
 Equality operator. More...
 
bool operator!= (const PIVector2D< T > &t) const
 Inequality operator.
 
PIVector< PIVector< T > > toVectors () const
 Converts the 2D array to a vector of vectors (PIVector<PIVector<T>>). Each row vector is a copy of the corresponding row. More...
 
const PIVector< T > & asPlainVector () const
 Returns a const reference to the underlying flat PIVector.
 
PIVector< T > & asPlainVector ()
 Returns a reference to the underlying flat PIVector.
 
PIVector< T > toPlainVector () const
 Returns a copy of the underlying flat PIVector.
 
void swap (PIVector2D< T > &other)
 Swaps this 2D array with another. Swaps the flat vectors and the dimension members. Very fast, no memory allocation. More...
 
void clear ()
 Clears the array, removing all elements and setting dimensions to 0. The capacity of the underlying flat vector may remain unchanged. More...
 
bool contains (const T &e) const
 Checks if the underlying flat vector contains the element e. More...
 
int entries (const T &e) const
 Counts occurrences of e in the underlying flat vector. More...
 
int entries (std::function< bool(const T &e)> test) const
 Counts elements in the flat vector that pass the test. More...
 
Index indexOf (const T &e) const
 Returns the first index (row, col) of e in the 2D array. More...
 
Index indexWhere (std::function< bool(const T &e)> test, ssize_t start=0) const
 Returns the first index (row, col) in the 2D array that passes the test. More...
 
Index lastIndexOf (const T &e, ssize_t start=-1) const
 Returns the last index (row, col) of e in the 2D array. More...
 
Index lastIndexWhere (std::function< bool(const T &e)> test, ssize_t start=-1) const
 Returns the last index (row, col) in the 2D array that passes the test. More...
 
bool any (std::function< bool(const T &e)> test) const
 Tests if any element in the flat vector passes the test. More...
 
bool every (std::function< bool(const T &e)> test) const
 Tests if all elements in the flat vector pass the test. More...
 
PIVector2D< T > & fill (const T &e=T())
 Fills the entire 2D array with copies of e. More...
 
PIVector2D< T > & fill (std::function< T(size_t i)> f)
 Fills the entire 2D array using a generator function f based on flat index. More...
 
PIVector2D< T > & assign (const T &e=T())
 Same as fill().
 
PIVector2D< T > & assign (size_t rows, size_t cols, const T &f=T())
 Assigns new size and fills with value. More...
 
PIVector2D< T > transposed () const
 Returns a transposed 2D array (rows become columns and vice versa). The element at (r, c) in the original becomes at (c, r) in the result.
 
PIVector2D< T > & reverseRows ()
 Reverses the order of rows in place. More...
 
PIVector2D< T > & reverseColumns ()
 Reverses the order of columns in each row in place. More...
 
PIVector2D< T > getRange (size_t rowStart, size_t rowCount, size_t colStart, size_t colCount) const
 Returns a sub-2D array (a range of rows and columns). If the range exceeds the array boundaries, it is clipped. If rowCount or colCount is 0, an empty array is returned. More...
 
template<typename ST >
PIVector2D< ST > map (std::function< ST(const T &e)> f) const
 Applies a function to each element and returns a new 2D array of a different type. The original array is not modified. More...
 
template<typename ST >
PIVector2D< ST > mapIndexed (std::function< ST(size_t row, size_t col, const T &e)> f) const
 Applies a function (with row and col indices) to each element and returns a new 2D array. More...
 
PIVector2D< T > & forEachRow (std::function< void(Row)> f)
 Applies a function to each row (modifiable). More...
 
void forEachRow (std::function< void(RowConst)> f) const
 Applies a function to each row (read-only).
 
PIVector2D< T > & forEachColumn (std::function< void(Col)> f)
 Applies a function to each column (modifiable).
 
void forEachColumn (std::function< void(ColConst)> f) const
 Applies a function to each column (read-only).
 
template<typename ST >
ST reduce (std::function< ST(const T &e, const ST &acc)> f, const ST &initial=ST()) const
 Accumulates a value across all elements. More...
 
template<typename ST >
ST reduceIndexed (std::function< ST(size_t row, size_t col, const T &e, const ST &acc)> f, const ST &initial=ST()) const
 Accumulates a value across all elements with indices. More...
 
PIVector2D< T > & removeRow (size_t row)
 Removes a row from the 2D array. If the last row is removed and the array becomes empty, cols() is set to 0. More...
 
PIVector2D< T > & removeColumn (size_t col)
 Removes a column from the 2D array. This operation is more expensive than removing a row because elements must be moved. More...
 
PIVector2D< T > & removeRowsWhere (std::function< bool(const RowConst &)> test)
 Removes all rows that satisfy a condition. Rows are removed from the bottom to avoid index shifting issues. More...
 
PIVector2D< T > & removeColumnsWhere (std::function< bool(const ColConst &)> test)
 Removes all columns that satisfy a condition. More...
 
PIVector2D< T > filterRows (std::function< bool(const RowConst &)> test) const
 Returns a new 2D array containing only the rows that pass the test. More...
 
PIVector2D< T > filterColumns (std::function< bool(const ColConst &)> test) const
 Returns a new 2D array containing only the columns that pass the test. More...
 

Detailed Description

template<typename T>
class PIVector2D< T >

2D array container.

This class is used to store a 2D array of elements of any type as a single continuous block of memory (a plain PIVector). Elements can be accessed using the [][] operators, where the first index is the row and the second is the column. Rows can be manipulated as PIVector objects, allowing modification of individual elements or assignment of entire rows. You cannot directly add or remove elements to change the dimensions of the array after construction (use resize(), addRow(), removeRow(), removeColumn() instead), but you can modify the values of existing elements.

Constructor & Destructor Documentation

◆ PIVector2D() [1/4]

template<typename T >
PIVector2D< T >::PIVector2D ( )
inline

Constructs an empty 2D array. No memory is allocated. After this constructor, rows() and cols() return 0, and isEmpty() returns true.

See also
PIVector::PIVector()

◆ PIVector2D() [2/4]

template<typename T >
PIVector2D< T >::PIVector2D ( size_t  rows,
size_t  cols,
const T &  f = T() 
)
inline

Constructs a 2D array with the given dimensions, filled with copies of f. The underlying storage is a single contiguous block of memory of size rows * cols. All elements are initialized with the value f.

See also
PIVector::PIVector(size_t, const T&)

◆ PIVector2D() [3/4]

template<typename T >
PIVector2D< T >::PIVector2D ( size_t  rows,
size_t  cols,
const PIVector< T > &  v 
)
inline

Constructs a 2D array from an existing 1D vector, reshaping it. The constructor copies the data from v into the internal flat vector. If v is larger than rows * cols, the excess elements are ignored (the vector is truncated). If v is smaller, other values filled whith default cunstructor T()

See also
PIVector::PIVector(const PIVector&), reshape()

◆ PIVector2D() [4/4]

template<typename T >
PIVector2D< T >::PIVector2D ( size_t  rows,
size_t  cols,
PIVector< T > &&  v 
)
inline

Move constructs a 2D array from an existing 1D vector, reshaping it. The data is moved from v into the internal flat vector, avoiding a copy. After construction, v is left in a valid but unspecified state.

See also
PIVector::PIVector(PIVector&&)

Member Function Documentation

◆ rows()

template<typename T >
size_t PIVector2D< T >::rows ( ) const
inline

Returns the number of rows in the 2D array. The result is always non-negative. If the array is empty, returns 0.

See also
cols(), size(), PIVector::size()

◆ cols()

template<typename T >
size_t PIVector2D< T >::cols ( ) const
inline

Returns the number of columns in the 2D array. The result is always non-negative. If the array is empty, returns 0.

See also
rows(), size(), PIVector::size()

◆ size()

template<typename T >
size_t PIVector2D< T >::size ( ) const
inline

Returns the total number of elements (rows * cols). This is equivalent to the size of the underlying flat vector.

See also
rows(), cols(), PIVector::size()

◆ size_s()

template<typename T >
ssize_t PIVector2D< T >::size_s ( ) const
inline

Returns the total number of elements as a signed value.

See also
size(), PIVector::size_s()

◆ length()

template<typename T >
size_t PIVector2D< T >::length ( ) const
inline

Returns the total number of elements (same as size()).

See also
size(), PIVector::length()

◆ isEmpty()

template<typename T >
bool PIVector2D< T >::isEmpty ( ) const
inline

Checks if the array has no elements. An empty array has both rows and columns equal to 0.

See also
isNotEmpty(), PIVector::isEmpty()

◆ isNotEmpty()

template<typename T >
bool PIVector2D< T >::isNotEmpty ( ) const
inline

Checks if the array has at least one element.

See also
isEmpty(), PIVector::isNotEmpty()

◆ element()

template<typename T >
T & PIVector2D< T >::element ( size_t  row,
size_t  col 
)
inline

Returns a reference to the element at the given row and column. No bounds checking is performed.

See also
at() (const version), PIVector::operator[]

◆ operator[]()

template<typename T >
Row PIVector2D< T >::operator[] ( size_t  index)
inline

Returns a proxy object for the row at the given index for modification.

See also
row(), Col

◆ data()

template<typename T >
T * PIVector2D< T >::data ( size_t  index = 0)
inline

Returns a pointer to the underlying flat data starting at an optional offset.

See also
PIVector::data()

◆ row()

template<typename T >
Row PIVector2D< T >::row ( size_t  index)
inline

Returns a proxy object for the row at the given index for modification.

See also
operator[]

◆ col()

template<typename T >
Col PIVector2D< T >::col ( size_t  index)
inline

Returns a proxy object for the column at the given index for modification.

See also
col() const

◆ addRow()

template<typename T >
PIVector2D< T > & PIVector2D< T >::addRow ( const RowConst other)
inline

Appends a new row to the bottom of the array from another Row object. If the array was empty, its column count is set to the size of the source row. Otherwise, only min(cols(), other.size()) elements are copied; the rest of the new row is default-initialized.

See also
PIVector::push_back()

◆ appendRows()

template<typename T >
PIVector2D< T > & PIVector2D< T >::appendRows ( size_t  count,
const T &  f = T() 
)
inline

Appends count new empty rows to the bottom of the array, filled with value f. If the array was empty (no columns defined), the column count is set to 1. The new rows are filled with the default value f.

See also
addRow(), appendColumns()

◆ appendColumns()

template<typename T >
PIVector2D< T > & PIVector2D< T >::appendColumns ( size_t  count,
const T &  f = T() 
)
inline

Appends count new empty columns to the end of each row of the array. If the array was empty (rows not defined), the array becomes a single row with count columns. If the array already has rows, new elements are inserted at the end of each existing row.

See also
appendRows(), addColumn()

◆ deleteRows()

template<typename T >
PIVector2D< T > & PIVector2D< T >::deleteRows ( size_t  row_start,
size_t  count 
)
inline

Deletes count rows starting from the specified row index. Removes the specified rows from the array and updates the row count. If all elements are deleted (array becomes empty), both rows and columns are set to 0.

See also
deleteColumns()

◆ deleteColumns()

template<typename T >
PIVector2D< T > & PIVector2D< T >::deleteColumns ( size_t  col_start,
size_t  count 
)
inline

Removes the specified columns from the array and updates the column count. Removes count columns starting from col_start. If col_start is out of range or count is 0, the function does nothing. If count extends beyond the last column, only available columns are deleted.

See also
removeColumn(), deleteRows()

◆ resize()

template<typename T >
PIVector2D< T > & PIVector2D< T >::resize ( size_t  rows,
size_t  cols,
const T &  f = T() 
)
inline

Resizes the 2D array to new dimensions. If the new dimensions are larger, new elements are appended and filled with copies of f. If they are smaller, the array is truncated (excess elements are destroyed). The underlying memory may be reallocated.

See also
PIVector::resize()

◆ operator==()

template<typename T >
bool PIVector2D< T >::operator== ( const PIVector2D< T > &  t) const
inline

Equality operator.

See also
PIVector::operator==

◆ toVectors()

template<typename T >
PIVector< PIVector< T > > PIVector2D< T >::toVectors ( ) const
inline

Converts the 2D array to a vector of vectors (PIVector<PIVector<T>>). Each row vector is a copy of the corresponding row.

See also
fromVectors(), PIVector::PIVector(const T*, size_t)

◆ swap()

template<typename T >
void PIVector2D< T >::swap ( PIVector2D< T > &  other)
inline

Swaps this 2D array with another. Swaps the flat vectors and the dimension members. Very fast, no memory allocation.

See also
PIVector::swap()

◆ clear()

template<typename T >
void PIVector2D< T >::clear ( )
inline

Clears the array, removing all elements and setting dimensions to 0. The capacity of the underlying flat vector may remain unchanged.

See also
PIVector::clear()

◆ contains()

template<typename T >
bool PIVector2D< T >::contains ( const T &  e) const
inline

Checks if the underlying flat vector contains the element e.

See also
PIVector::contains()

◆ entries() [1/2]

template<typename T >
int PIVector2D< T >::entries ( const T &  e) const
inline

Counts occurrences of e in the underlying flat vector.

See also
PIVector::entries()

◆ entries() [2/2]

template<typename T >
int PIVector2D< T >::entries ( std::function< bool(const T &e)>  test) const
inline

Counts elements in the flat vector that pass the test.

See also
PIVector::entries(std::function)

◆ indexOf()

template<typename T >
Index PIVector2D< T >::indexOf ( const T &  e) const
inline

Returns the first index (row, col) of e in the 2D array.

See also
PIVector::indexOf()

◆ indexWhere()

template<typename T >
Index PIVector2D< T >::indexWhere ( std::function< bool(const T &e)>  test,
ssize_t  start = 0 
) const
inline

Returns the first index (row, col) in the 2D array that passes the test.

See also
PIVector::indexWhere()

◆ lastIndexOf()

template<typename T >
Index PIVector2D< T >::lastIndexOf ( const T &  e,
ssize_t  start = -1 
) const
inline

Returns the last index (row, col) of e in the 2D array.

See also
PIVector::lastIndexOf()

◆ lastIndexWhere()

template<typename T >
Index PIVector2D< T >::lastIndexWhere ( std::function< bool(const T &e)>  test,
ssize_t  start = -1 
) const
inline

Returns the last index (row, col) in the 2D array that passes the test.

See also
PIVector::lastIndexWhere()

◆ any()

template<typename T >
bool PIVector2D< T >::any ( std::function< bool(const T &e)>  test) const
inline

Tests if any element in the flat vector passes the test.

See also
PIVector::any()

◆ every()

template<typename T >
bool PIVector2D< T >::every ( std::function< bool(const T &e)>  test) const
inline

Tests if all elements in the flat vector pass the test.

See also
PIVector::every()

◆ fill() [1/2]

template<typename T >
PIVector2D< T > & PIVector2D< T >::fill ( const T &  e = T())
inline

Fills the entire 2D array with copies of e.

See also
PIVector::fill()

◆ fill() [2/2]

template<typename T >
PIVector2D< T > & PIVector2D< T >::fill ( std::function< T(size_t i)>  f)
inline

Fills the entire 2D array using a generator function f based on flat index.

See also
PIVector::fill(std::function)

◆ assign()

template<typename T >
PIVector2D< T > & PIVector2D< T >::assign ( size_t  rows,
size_t  cols,
const T &  f = T() 
)
inline

Assigns new size and fills with value.

See also
PIVector::assign(size_t, const T&)

◆ reverseRows()

template<typename T >
PIVector2D< T > & PIVector2D< T >::reverseRows ( )
inline

Reverses the order of rows in place.

See also
reverseColumns(), PIVector::reverse()

◆ reverseColumns()

template<typename T >
PIVector2D< T > & PIVector2D< T >::reverseColumns ( )
inline

Reverses the order of columns in each row in place.

See also
reverseRows(), PIVector::reverse()

◆ getRange()

template<typename T >
PIVector2D< T > PIVector2D< T >::getRange ( size_t  rowStart,
size_t  rowCount,
size_t  colStart,
size_t  colCount 
) const
inline

Returns a sub-2D array (a range of rows and columns). If the range exceeds the array boundaries, it is clipped. If rowCount or colCount is 0, an empty array is returned.

See also
PIVector::getRange()

◆ map()

template<typename T >
template<typename ST >
PIVector2D< ST > PIVector2D< T >::map ( std::function< ST(const T &e)>  f) const
inline

Applies a function to each element and returns a new 2D array of a different type. The original array is not modified.

See also
PIVector::map()

◆ mapIndexed()

template<typename T >
template<typename ST >
PIVector2D< ST > PIVector2D< T >::mapIndexed ( std::function< ST(size_t row, size_t col, const T &e)>  f) const
inline

Applies a function (with row and col indices) to each element and returns a new 2D array.

See also
PIVector::mapIndexed()

◆ forEachRow()

template<typename T >
PIVector2D< T > & PIVector2D< T >::forEachRow ( std::function< void(Row)>  f)
inline

Applies a function to each row (modifiable).

See also
forEachRow() const, PIVector::forEach()

◆ reduce()

template<typename T >
template<typename ST >
ST PIVector2D< T >::reduce ( std::function< ST(const T &e, const ST &acc)>  f,
const ST &  initial = ST() 
) const
inline

Accumulates a value across all elements.

See also
PIVector::reduce()

◆ reduceIndexed()

template<typename T >
template<typename ST >
ST PIVector2D< T >::reduceIndexed ( std::function< ST(size_t row, size_t col, const T &e, const ST &acc)>  f,
const ST &  initial = ST() 
) const
inline

Accumulates a value across all elements with indices.

See also
PIVector::reduceIndexed()

◆ removeRow()

template<typename T >
PIVector2D< T > & PIVector2D< T >::removeRow ( size_t  row)
inline

Removes a row from the 2D array. If the last row is removed and the array becomes empty, cols() is set to 0.

See also
removeColumn(), PIVector::remove()

◆ removeColumn()

template<typename T >
PIVector2D< T > & PIVector2D< T >::removeColumn ( size_t  col)
inline

Removes a column from the 2D array. This operation is more expensive than removing a row because elements must be moved.

See also
removeRow(), PIVector::remove()

◆ removeRowsWhere()

template<typename T >
PIVector2D< T > & PIVector2D< T >::removeRowsWhere ( std::function< bool(const RowConst &)>  test)
inline

Removes all rows that satisfy a condition. Rows are removed from the bottom to avoid index shifting issues.

See also
removeColumnsWhere(), PIVector::removeWhere()

◆ removeColumnsWhere()

template<typename T >
PIVector2D< T > & PIVector2D< T >::removeColumnsWhere ( std::function< bool(const ColConst &)>  test)
inline

Removes all columns that satisfy a condition.

See also
removeRowsWhere()

◆ filterRows()

template<typename T >
PIVector2D< T > PIVector2D< T >::filterRows ( std::function< bool(const RowConst &)>  test) const
inline

Returns a new 2D array containing only the rows that pass the test.

See also
filterColumns(), PIVector::filter()

◆ filterColumns()

template<typename T >
PIVector2D< T > PIVector2D< T >::filterColumns ( std::function< bool(const ColConst &)>  test) const
inline

Returns a new 2D array containing only the columns that pass the test.

See also
filterRows()