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

Proxy class representing a single read-only row in a PIVector2D. Returned by const operator[] or row(). Provides const access to row elements. More...

#include <pivector2d.h>

Inheritance diagram for PIVector2D< T >::RowConst:
Inheritance graph
[legend]

Public Member Functions

 RowConst (const PIVector2D< T >::Row &r)
 Copy constructor from modifiable Row to read-only RowConst. More...
 
size_t size () const
 Size of the row (number of columns).
 
const T & operator[] (size_t index) const
 Const access to the element at the given column index within the row.
 
const T * data (size_t index=0) const
 Returns a const pointer to the row data starting at an optional offset.
 
PIVector< T > toVector () const
 Converts the row to a PIVector.
 
ssize_t indexOf (const T &e, ssize_t start=0) const
 Returns the first index of element e in the row, starting from start. See PIVector::indexOf() for details on negative start handling. More...
 
ssize_t lastIndexOf (const T &e, ssize_t start=-1) const
 Returns the last index of element e in the row, searching backwards from start. More...
 
ssize_t indexWhere (std::function< bool(const T &e)> test, ssize_t start=0) const
 Returns the first index where the predicate test returns true, starting from start. More...
 
ssize_t lastIndexWhere (std::function< bool(const T &e)> test, ssize_t start=-1) const
 Returns the last index where the predicate test returns true, searching backwards from start. More...
 
void forEach (std::function< void(const T &)> func) const
 Applies a function to each element of the row (read-only). The function can't modify the elements. More...
 
bool contains (const T &e, ssize_t start=0) const
 Checks if the row contains the element e. More...
 
int entries (const T &e, ssize_t start=0) const
 Counts occurrences of e in the row. More...
 
int entries (std::function< bool(const T &e)> test, ssize_t start=0) const
 Counts elements in the row that pass the test. More...
 
bool any (std::function< bool(const T &e)> test) const
 Tests if any element in the row passes the test. More...
 
bool every (std::function< bool(const T &e)> test) const
 Tests if all elements in the row pass the test. More...
 

Detailed Description

template<typename T>
class PIVector2D< T >::RowConst

Proxy class representing a single read-only row in a PIVector2D. Returned by const operator[] or row(). Provides const access to row elements.

See also
Row, ColConst

Constructor & Destructor Documentation

◆ RowConst()

template<typename T >
PIVector2D< T >::RowConst::RowConst ( const PIVector2D< T >::Row &  r)
inline

Copy constructor from modifiable Row to read-only RowConst.

See also
Row

Member Function Documentation

◆ indexOf()

template<typename T >
ssize_t PIVector2D< T >::RowConst::indexOf ( const T &  e,
ssize_t  start = 0 
) const
inline

Returns the first index of element e in the row, starting from start. See PIVector::indexOf() for details on negative start handling.

See also
PIVector::indexOf()

◆ lastIndexOf()

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

Returns the last index of element e in the row, searching backwards from start.

See also
PIVector::lastIndexOf()

◆ indexWhere()

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

Returns the first index where the predicate test returns true, starting from start.

See also
PIVector::indexWhere()

◆ lastIndexWhere()

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

Returns the last index where the predicate test returns true, searching backwards from start.

See also
PIVector::lastIndexWhere()

◆ forEach()

template<typename T >
void PIVector2D< T >::RowConst::forEach ( std::function< void(const T &)>  func) const
inline

Applies a function to each element of the row (read-only). The function can't modify the elements.

See also
forEach (modifiable)

◆ contains()

template<typename T >
bool PIVector2D< T >::RowConst::contains ( const T &  e,
ssize_t  start = 0 
) const
inline

Checks if the row contains the element e.

See also
PIVector::contains()

◆ entries() [1/2]

template<typename T >
int PIVector2D< T >::RowConst::entries ( const T &  e,
ssize_t  start = 0 
) const
inline

Counts occurrences of e in the row.

See also
PIVector::entries()

◆ entries() [2/2]

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

Counts elements in the row that pass the test.

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

◆ any()

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

Tests if any element in the row passes the test.

See also
PIVector::any()

◆ every()

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

Tests if all elements in the row pass the test.

See also
PIVector::every()