Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::DynArray< T >::Proxy Class Reference
Collaboration diagram for Aleph::DynArray< T >::Proxy:
[legend]

Public Member Functions

 Proxy (DynArray< T > &_array, const size_t i) noexcept
 
 operator T& ()
 Return a modifiable reference to the entry.
 
T * operator-> ()
 
Proxy & operator= (const T &data)
 
Proxy & operator= (const Proxy &proxy)
 

Private Attributes

size_t index
 
size_t pos_in_dir
 
size_t pos_in_seg
 
size_t pos_in_block
 
T **& ref_seg
 
T * block
 
DynArray & array
 

Detailed Description

template<typename T>
class Aleph::DynArray< T >::Proxy

Definition at line 561 of file tpl_dynArray.H.

Constructor & Destructor Documentation

◆ Proxy()

template<typename T >
Aleph::DynArray< T >::Proxy::Proxy ( DynArray< T > &  _array,
const size_t  i 
)
inlinenoexcept

Member Function Documentation

◆ operator T&()

template<typename T >
Aleph::DynArray< T >::Proxy::operator T& ( )
inline

Return a modifiable reference to the entry.

The proxy cannot tell a read (int x = a[i]) from a modification (a[i] += 1), so it allocates the entry's block, exactly as operator->() does: an entry that was never written then holds the default value and writes through the reference are kept. To read without allocating, use read() or a const array.

Returns
Reference to the entry.
Exceptions
bad_allocif the segment or block cannot be allocated.

Definition at line 592 of file tpl_dynArray.H.

◆ operator->()

◆ operator=() [1/2]

◆ operator=() [2/2]

Member Data Documentation

◆ array

◆ block

◆ index

template<typename T >
size_t Aleph::DynArray< T >::Proxy::index
private

◆ pos_in_block

template<typename T >
size_t Aleph::DynArray< T >::Proxy::pos_in_block
private

◆ pos_in_dir

template<typename T >
size_t Aleph::DynArray< T >::Proxy::pos_in_dir
private

◆ pos_in_seg

◆ ref_seg


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