MLIR  19.0.0git
Classes | Public Member Functions | List of all members
mlir::RaggedArray< T > Class Template Reference

A 2D array where each row may have different length. More...

#include "mlir/Dialect/Transform/Utils/RaggedArray.h"

+ Inheritance diagram for mlir::RaggedArray< T >:

Classes

class  const_iterator
 Constant iterator over the rows. More...
 
class  iterator
 Iterator over the rows. More...
 

Public Member Functions

size_t size () const
 Returns the number of rows in the 2D array. More...
 
bool empty () const
 Returns true if the are no rows in the 2D array. More...
 
ArrayRef< T > operator[] (size_t pos) const
 Accesses pos-th row. More...
 
ArrayRef< T > at (size_t pos) const
 
MutableArrayRef< T > operator[] (size_t pos)
 
MutableArrayRef< T > at (size_t pos)
 
const_iterator begin () const
 Iterator over rows. More...
 
const_iterator end () const
 
iterator begin ()
 
iterator end ()
 
void reserve (size_t size, size_t nestedSize=0)
 Reserve space to store size rows with nestedSize elements each. More...
 
template<typename Range >
void push_back (Range &&elements)
 Appends the given range of elements as a new row to the 2D array. More...
 
template<typename Range >
void replace (size_t pos, Range &&elements)
 Replaces the pos-th row in the 2D array with the given range of elements. More...
 
void appendEmptyRows (size_t num)
 Appends num empty rows to the array. More...
 
void removeFront ()
 Removes the first subarray in-place. Invalidates iterators to all rows. More...
 

Detailed Description

template<typename T>
class mlir::RaggedArray< T >

A 2D array where each row may have different length.

Elements of each row are stored contiguously, but rows don't have a fixed order in the storage.

Definition at line 18 of file RaggedArray.h.

Member Function Documentation

◆ appendEmptyRows()

template<typename T >
void mlir::RaggedArray< T >::appendEmptyRows ( size_t  num)
inline

Appends num empty rows to the array.

Definition at line 149 of file RaggedArray.h.

◆ at() [1/2]

template<typename T >
MutableArrayRef<T> mlir::RaggedArray< T >::at ( size_t  pos)
inline

Definition at line 35 of file RaggedArray.h.

◆ at() [2/2]

template<typename T >
ArrayRef<T> mlir::RaggedArray< T >::at ( size_t  pos) const
inline

◆ begin() [1/2]

template<typename T >
iterator mlir::RaggedArray< T >::begin ( )
inline

Definition at line 113 of file RaggedArray.h.

◆ begin() [2/2]

template<typename T >
const_iterator mlir::RaggedArray< T >::begin ( ) const
inline

Iterator over rows.

Definition at line 111 of file RaggedArray.h.

◆ empty()

template<typename T >
bool mlir::RaggedArray< T >::empty ( ) const
inline

Returns true if the are no rows in the 2D array.

Note that an array with a non-zero number of empty rows is NOT empty.

Definition at line 25 of file RaggedArray.h.

Referenced by mlir::transform::applyTransformNamedSequence().

◆ end() [1/2]

template<typename T >
iterator mlir::RaggedArray< T >::end ( )
inline

Definition at line 114 of file RaggedArray.h.

◆ end() [2/2]

template<typename T >
const_iterator mlir::RaggedArray< T >::end ( ) const
inline

Definition at line 112 of file RaggedArray.h.

◆ operator[]() [1/2]

template<typename T >
MutableArrayRef<T> mlir::RaggedArray< T >::operator[] ( size_t  pos)
inline

Definition at line 34 of file RaggedArray.h.

References mlir::RaggedArray< T >::at().

◆ operator[]() [2/2]

template<typename T >
ArrayRef<T> mlir::RaggedArray< T >::operator[] ( size_t  pos) const
inline

Accesses pos-th row.

Definition at line 28 of file RaggedArray.h.

References mlir::RaggedArray< T >::at().

◆ push_back()

template<typename T >
template<typename Range >
void mlir::RaggedArray< T >::push_back ( Range &&  elements)
inline

Appends the given range of elements as a new row to the 2D array.

May invalidate the end iterator.

Definition at line 125 of file RaggedArray.h.

Referenced by mlir::transform::applyTransformNamedSequence().

◆ removeFront()

template<typename T >
void mlir::RaggedArray< T >::removeFront ( )
inline

Removes the first subarray in-place. Invalidates iterators to all rows.

Definition at line 154 of file RaggedArray.h.

Referenced by mlir::transform::applyTransformNamedSequence().

◆ replace()

template<typename T >
template<typename Range >
void mlir::RaggedArray< T >::replace ( size_t  pos,
Range &&  elements 
)
inline

Replaces the pos-th row in the 2D array with the given range of elements.

Invalidates iterators and references to pos-th and all succeeding rows.

Definition at line 133 of file RaggedArray.h.

References mlir::RaggedArray< T >::size().

◆ reserve()

template<typename T >
void mlir::RaggedArray< T >::reserve ( size_t  size,
size_t  nestedSize = 0 
)
inline

Reserve space to store size rows with nestedSize elements each.

Definition at line 117 of file RaggedArray.h.

References mlir::RaggedArray< T >::size().

◆ size()

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

Returns the number of rows in the 2D array.

Definition at line 21 of file RaggedArray.h.

Referenced by mlir::RaggedArray< T >::replace(), and mlir::RaggedArray< T >::reserve().


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