barretenberg
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
RefArray< T, N > Class Template Reference

A template class for a reference array. Behaves as if std::array<T&, N> was possible. More...

#include <ref_array.hpp>

Classes

class  iterator
 Nested iterator class for RefArray, based on indexing into the pointer array. Provides semantics similar to what would be expected if std::array<T&, N> was possible. More...
 

Public Member Functions

 RefArray (const std::array< T *, N > &ptr_array)
 
template<typename... Ts>
 RefArray (T &ref, Ts &... rest)
 
T & operator[] (std::size_t idx) const
 
constexpr std::size_t size () const
 
iterator begin () const
 Returns an iterator to the beginning of the RefArray.
 
iterator end () const
 Returns an iterator to the end of the RefArray.
 

Detailed Description

template<typename T, std::size_t N>
class RefArray< T, N >

A template class for a reference array. Behaves as if std::array<T&, N> was possible.

This class provides a fixed-size array of pointers to elements of type T, exposed as references. It offers random access to its elements and provides an iterator class for traversal.

Template Parameters
TThe type of elements stored in the array.
NThe size of the array.

Member Function Documentation

◆ begin()

template<typename T , std::size_t N>
iterator RefArray< T, N >::begin ( ) const
inline

Returns an iterator to the beginning of the RefArray.

Returns
An iterator to the first element.

◆ end()

template<typename T , std::size_t N>
iterator RefArray< T, N >::end ( ) const
inline

Returns an iterator to the end of the RefArray.

Returns
An iterator to the element following the last element.

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