jiwoo
Automatic memory management of containers of array pointers
Loading...
Searching...
No Matches
jiwoo::EquilengthArrays< Value_ > Class Template Reference

Array of equilength arrays. More...

#include <EquilengthArrays.hpp>

Public Member Functions

 EquilengthArrays ()=default
 
 EquilengthArrays (std::size_t size, std::size_t length)
 
 EquilengthArrays (std::size_t size, std::size_t length, Value_ fill)
 
 EquilengthArrays (const EquilengthArrays &other)
 
 EquilengthArrays (EquilengthArrays &&other) noexcept
 
 ~EquilengthArrays ()
 
EquilengthArrays & operator= (const EquilengthArrays &other)
 
EquilengthArrays & operator= (EquilengthArrays &&other) noexcept
 
void swap (EquilengthArrays &other) noexcept
 
std::size_t size () const
 
std::size_t length () const
 
bool empty () const
 
Value_ * operator[] (std::size_t i)
 
const Value_ * operator[] (std::size_t i) const
 
Value_ *const * get ()
 
const Value_ *const * get () const
 
Value_ * front ()
 
const Value_ * front () const
 
Value_ * back ()
 
const Value_ * back () const
 
Value_ *const * begin ()
 
const Value_ *const * begin () const
 
Value_ *const * end ()
 
const Value_ *const * end () const
 

Detailed Description

template<typename Value_>
class jiwoo::EquilengthArrays< Value_ >

Array of equilength arrays.

Template Parameters
Value_Value of the inner arrays.

An instance x of this class is such that x[i][j] yields a Value_ for i in [0, size) and j in [0, length).

Constructor & Destructor Documentation

◆ EquilengthArrays() [1/5]

template<typename Value_ >
jiwoo::EquilengthArrays< Value_ >::EquilengthArrays ( )
default

Default constructor. This does not perform any allocation and sets the size and length to zero.

◆ EquilengthArrays() [2/5]

template<typename Value_ >
jiwoo::EquilengthArrays< Value_ >::EquilengthArrays ( std::size_t size,
std::size_t length )
inline
Parameters
sizeNumber of inner arrays.
lengthLength of each inner array.

This constructor will not initialize the values of the inner arrays. If an initial value is desired, consider using the overloaded constructor below.

◆ EquilengthArrays() [3/5]

template<typename Value_ >
jiwoo::EquilengthArrays< Value_ >::EquilengthArrays ( std::size_t size,
std::size_t length,
Value_ fill )
inline
Parameters
sizeNumber of inner arrays.
lengthLength of each inner array.
fillInitial value with which to fill the inner arrays.

◆ EquilengthArrays() [4/5]

template<typename Value_ >
jiwoo::EquilengthArrays< Value_ >::EquilengthArrays ( const EquilengthArrays< Value_ > & other)
inline

Copy constructor.

Parameters
otherAn EquilengthArray to be copied.

◆ EquilengthArrays() [5/5]

template<typename Value_ >
jiwoo::EquilengthArrays< Value_ >::EquilengthArrays ( EquilengthArrays< Value_ > && other)
inlinenoexcept

Move constructor.

Parameters
otherAn EquilengthArray to move from. On return, this has its size set to zero.

◆ ~EquilengthArrays()

template<typename Value_ >
jiwoo::EquilengthArrays< Value_ >::~EquilengthArrays ( )
inline

Destructor.

Member Function Documentation

◆ back() [1/2]

template<typename Value_ >
Value_ * jiwoo::EquilengthArrays< Value_ >::back ( )
inline
Returns
Pointer to the start of the last array.

This method is only valid if size() is positive.

◆ back() [2/2]

template<typename Value_ >
const Value_ * jiwoo::EquilengthArrays< Value_ >::back ( ) const
inline
Returns
Pointer to the start of the last array.

This method is only valid if size() is positive.

◆ begin() [1/2]

template<typename Value_ >
Value_ *const * jiwoo::EquilengthArrays< Value_ >::begin ( )
inline
Returns
Pointer to the start of the array of arrays. If size() > 0, deferencing this pointer is equivalent to front().

◆ begin() [2/2]

template<typename Value_ >
const Value_ *const * jiwoo::EquilengthArrays< Value_ >::begin ( ) const
inline
Returns
Pointer to the start of the array of arrays. If size() > 0, deferencing this pointer is equivalent to front().

◆ empty()

template<typename Value_ >
bool jiwoo::EquilengthArrays< Value_ >::empty ( ) const
inline
Returns
Whether this object is empty, i.e., no inner arrays.

◆ end() [1/2]

template<typename Value_ >
Value_ *const * jiwoo::EquilengthArrays< Value_ >::end ( )
inline
Returns
Pointer to the end of the array of arrays. The difference between this and begin() is equal to size().

◆ end() [2/2]

template<typename Value_ >
const Value_ *const * jiwoo::EquilengthArrays< Value_ >::end ( ) const
inline
Returns
Pointer to the end of the array of arrays. The difference between this and begin() is equal to size().

◆ front() [1/2]

template<typename Value_ >
Value_ * jiwoo::EquilengthArrays< Value_ >::front ( )
inline
Returns
Pointer to the start of the first array.

This method is only valid if size() is positive.

◆ front() [2/2]

template<typename Value_ >
const Value_ * jiwoo::EquilengthArrays< Value_ >::front ( ) const
inline
Returns
Pointer to the start of the first array.

This method is only valid if size() is positive.

◆ get() [1/2]

template<typename Value_ >
Value_ *const * jiwoo::EquilengthArrays< Value_ >::get ( )
inline
Returns
Pointer to the start of the array of pointers to all inner arrays.

◆ get() [2/2]

template<typename Value_ >
const Value_ *const * jiwoo::EquilengthArrays< Value_ >::get ( ) const
inline
Returns
const pointer to the start of the array of pointers to all inner arrays.

◆ length()

template<typename Value_ >
std::size_t jiwoo::EquilengthArrays< Value_ >::length ( ) const
inline
Returns
Length of each inner array.

◆ operator=() [1/2]

template<typename Value_ >
EquilengthArrays & jiwoo::EquilengthArrays< Value_ >::operator= ( const EquilengthArrays< Value_ > & other)
inline

Copy assignment. This will attempt to use as much of the current object's existing allocation as possible, otherwise it will perform a new allocation.

Parameters
otherAn EquilengthArray to be copied.

◆ operator=() [2/2]

template<typename Value_ >
EquilengthArrays & jiwoo::EquilengthArrays< Value_ >::operator= ( EquilengthArrays< Value_ > && other)
inlinenoexcept

Move assignment.

Parameters
otherAn EquilengthArray to be moved from. On return, this will have its size and length set to zero.

◆ operator[]() [1/2]

template<typename Value_ >
Value_ * jiwoo::EquilengthArrays< Value_ >::operator[] ( std::size_t i)
inline
Parameters
iIndex of the inner array. This should be non-negative and less than size().
Returns
Pointer to the start of the i-th inner array.

◆ operator[]() [2/2]

template<typename Value_ >
const Value_ * jiwoo::EquilengthArrays< Value_ >::operator[] ( std::size_t i) const
inline
Parameters
iIndex of the inner array. This should be non-negative and less than size().
Returns
const pointer to the start of the i-th inner array.

◆ size()

template<typename Value_ >
std::size_t jiwoo::EquilengthArrays< Value_ >::size ( ) const
inline
Returns
Number of inner arrays.

◆ swap()

template<typename Value_ >
void jiwoo::EquilengthArrays< Value_ >::swap ( EquilengthArrays< Value_ > & other)
inlinenoexcept
Parameters
otherAn EquilengthArray to swap contents with. On return, *this will have the contents of other and vice versa.

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