SubList< T > Class Template Reference

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

Public Member Functions

 SubList (const SubList &)=default
 Copy construct. More...
 
 SubList (const UList< T > &list)
 Construct from UList, 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. More...
 
void operator= (const UList< T > &list)
 Copy assign entries from given list. 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 53 of file SubList.H.

Constructor & Destructor Documentation

◆ SubList() [1/6]

SubList ( const SubList< T > &  )
default

Copy construct.

◆ SubList() [2/6]

SubList ( const UList< T > &  list)
inlineexplicit

Construct from UList, the entire size.

Definition at line 33 of file SubListI.H.

◆ SubList() [3/6]

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

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

Definition at line 43 of file SubListI.H.

References UList< T >::checkSize().

Here is the call graph for this function:

◆ SubList() [4/6]

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

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

Definition at line 58 of file SubListI.H.

References UList< T >::checkSize(), and UList< T >::checkStart().

Here is the call graph for this function:

◆ SubList() [5/6]

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 86 of file SubListI.H.

◆ SubList() [6/6]

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 97 of file SubListI.H.

Member Function Documentation

◆ null()

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

Return a null SubList.

Definition at line 109 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 118 of file SubListI.H.

◆ operator=() [1/4]

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

Copy assign entries from given sub-list.

Definition at line 125 of file SubListI.H.

◆ operator=() [2/4]

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

Copy assign entries from given list.

Definition at line 132 of file SubListI.H.

◆ operator=() [3/4]

void operator= ( const T val)
inline

Assign all entries to the given value.

Definition at line 139 of file SubListI.H.

◆ operator=() [4/4]

void operator= ( const Foam::zero  )
inline

Assign all entries to zero.

Definition at line 146 of file SubListI.H.

References Foam::Zero.


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