SubList< T > Class Template Reference

A List obtained as a section of another List. More...

Public Member Functions

 SubList () noexcept=default
 Default construct, zero-sized and nullptr. More...
 
 SubList (const SubList &) noexcept=default
 Copy construct, shallow copy. More...
 
 SubList (const UList< T > &list)
 Construct from UList, the entire size. More...
 
template<unsigned N>
 SubList (const FixedList< T, N > &list)
 Construct from FixedList, the entire size. More...
 
 SubList (const UList< T > &list, const label subSize)
 Construct from UList and sub-list size, start at 0. More...
 
 SubList (const UList< T > &list, const label subSize, const label startIndex)
 Construct from UList, sub-list size and start index. More...
 
 SubList (const UList< T > &list, const labelRange &range)
 Construct from UList and a (start,size) range. More...
 
 SubList (const labelRange &range, const UList< T > &list)
 
 operator const Foam::List< T > & () const
 Allow cast to a const List<T>&. More...
 
void operator= (const SubList< T > &list)
 Copy assign entries from given sub-list. Sizes must match! More...
 
void operator= (const UList< T > &list)
 Copy assign entries from given list. Sizes must match! More...
 
template<class Addr >
void operator= (const IndirectListBase< T, Addr > &list)
 Copy assign entries from given indirect list. Sizes must match! More...
 
void operator= (const T &val)
 Assign all entries to the given value. More...
 
void operator= (const Foam::zero)
 Assign all entries to zero. More...
 

Static Public Member Functions

static const SubList< T > & null ()
 Return a null SubList. More...
 

Detailed Description

template<class T>
class Foam::SubList< T >

A List obtained as a section of another List.

Since the SubList is itself unallocated, no storage is allocated or de-allocated during its use. To achieve this behaviour, SubList is derived from UList rather than List.

Source files

Definition at line 54 of file SubList.H.

Constructor & Destructor Documentation

◆ SubList() [1/8]

SubList ( )
defaultnoexcept

Default construct, zero-sized and nullptr.

◆ SubList() [2/8]

SubList ( const SubList< T > &  )
defaultnoexcept

Copy construct, shallow copy.

◆ SubList() [3/8]

SubList ( const UList< T > &  list)
inlineexplicit

Construct from UList, the entire size.

Definition at line 33 of file SubListI.H.

◆ SubList() [4/8]

SubList ( const FixedList< T, N > &  list)
inlineexplicit

Construct from FixedList, the entire size.

Definition at line 44 of file SubListI.H.

◆ SubList() [5/8]

SubList ( const UList< T > &  list,
const label  subSize 
)
inline

Construct from UList and sub-list size, start at 0.

Definition at line 54 of file SubListI.H.

References UList< T >::checkSize().

Here is the call graph for this function:

◆ SubList() [6/8]

SubList ( const UList< T > &  list,
const label  subSize,
const label  startIndex 
)
inline

Construct from UList, sub-list size and start index.

Definition at line 69 of file SubListI.H.

References UList< T >::checkRange().

Here is the call graph for this function:

◆ SubList() [7/8]

SubList ( const UList< T > &  list,
const labelRange range 
)
inline

Construct from UList and a (start,size) range.

The range is subsetted with the list size itself to ensure that the result always addresses a valid section of the list.

Definition at line 85 of file SubListI.H.

References UList< T >::checkRange(), and range.

Here is the call graph for this function:

◆ SubList() [8/8]

SubList ( const labelRange range,
const UList< T > &  list 
)
inline

Construct from UList and a (start,size) range, but bypassing run-time range checking.

Definition at line 102 of file SubListI.H.

Member Function Documentation

◆ null()

const Foam::SubList< T > & null ( )
inlinestatic

Return a null SubList.

Definition at line 114 of file SubListI.H.

◆ operator const Foam::List< T > &()

operator const Foam::List< T > & ( ) const
inline

Allow cast to a const List<T>&.

Definition at line 123 of file SubListI.H.

◆ operator=() [1/5]

void operator= ( const SubList< T > &  list)
inline

Copy assign entries from given sub-list. Sizes must match!

Definition at line 130 of file SubListI.H.

◆ operator=() [2/5]

void operator= ( const UList< T > &  list)
inline

Copy assign entries from given list. Sizes must match!

Definition at line 137 of file SubListI.H.

◆ operator=() [3/5]

void operator= ( const IndirectListBase< T, Addr > &  list)
inline

Copy assign entries from given indirect list. Sizes must match!

Definition at line 145 of file SubListI.H.

◆ operator=() [4/5]

void operator= ( const T val)
inline

Assign all entries to the given value.

Definition at line 152 of file SubListI.H.

◆ operator=() [5/5]

void operator= ( const Foam::zero  )
inline

Assign all entries to zero.

Definition at line 159 of file SubListI.H.

References Foam::Zero.


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