Public Member Functions | List of all members
SortableList Class Reference

A list that is sorted upon construction or when explicitly requested with the sort() method. More...

Public Member Functions

constexpr SortableList () noexcept
 
 SortableList (const label size)
 
 SortableList (const label size, const Foam::zero)
 
 SortableList (const label size, const T &val)
 
 SortableList (const SortableList< T > &lst)
 
 SortableList (SortableList< T > &&lst)
 
 SortableList (const UList< T > &values)
 
 SortableList (List< T > &&values)
 
 SortableList (std::initializer_list< T > values)
 
const labelListindices () const
 
labelListindices ()
 
void clear ()
 
List< T > & shrink ()
 
void sort ()
 
void reverseSort ()
 
void partialSort (label n, label start=0)
 
void partialReverseSort (label n, label start=0)
 
void swap (SortableList< T > &other)
 
void operator= (const T &val)
 
void operator= (const UList< T > &lst)
 
void operator= (const SortableList< T > &lst)
 
void operator= (List< T > &&lst)
 
void operator= (SortableList< T > &&lst)
 
void operator= (std::initializer_list< T > lst)
 

Detailed Description

A list that is sorted upon construction or when explicitly requested with the sort() method.

Uses the std::stable_sort() algorithm.

Note
In many cases you may wish to reuse list storage. The Foam::sortedOrder() function and the Foam::SortList container provide two other alternatives.
Source files

Definition at line 56 of file List.H.

Constructor & Destructor Documentation

◆ SortableList() [1/9]

constexpr SortableList ( )
inlineconstexprnoexcept

◆ SortableList() [2/9]

SortableList ( const label  size)
inlineexplicit

Definition at line 35 of file SortableList.C.

◆ SortableList() [3/9]

SortableList ( const label  size,
const Foam::zero   
)
inline

Definition at line 42 of file SortableList.C.

◆ SortableList() [4/9]

SortableList ( const label  size,
const T val 
)
inline

Definition at line 49 of file SortableList.C.

◆ SortableList() [5/9]

SortableList ( const SortableList< T > &  lst)
inline

Definition at line 56 of file SortableList.C.

◆ SortableList() [6/9]

SortableList ( SortableList< T > &&  lst)
inline

Definition at line 64 of file SortableList.C.

◆ SortableList() [7/9]

SortableList ( const UList< T > &  values)
inlineexplicit

Definition at line 72 of file SortableList.C.

References SortableList::sort().

Here is the call graph for this function:

◆ SortableList() [8/9]

SortableList ( List< T > &&  values)
inline

Definition at line 81 of file SortableList.C.

References SortableList::sort().

Here is the call graph for this function:

◆ SortableList() [9/9]

SortableList ( std::initializer_list< T values)
inline

Definition at line 90 of file SortableList.C.

References SortableList::sort().

Here is the call graph for this function:

Member Function Documentation

◆ indices() [1/2]

const labelList& indices ( ) const
inline

◆ indices() [2/2]

labelList& indices ( )
inline

Definition at line 110 of file SortableList.H.

◆ clear()

void clear ( )

Definition at line 101 of file SortableList.C.

References List::clear().

Here is the call graph for this function:

◆ shrink()

Foam::List< T > & shrink ( )

Definition at line 109 of file SortableList.C.

References List::clear().

Referenced by DynamicList< Foam::FixedList< scalar, 3 > >::transfer(), and List< vectorField >::transfer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sort()

void sort ( )

◆ reverseSort()

void reverseSort ( )

Definition at line 127 of file SortableList.C.

References Foam::sortedOrder(), and List::transfer().

Here is the call graph for this function:

◆ partialSort()

void partialSort ( label  n,
label  start = 0 
)

Definition at line 137 of file SortableList.C.

References Foam::ListOps::identity(), n, and List::transfer().

Here is the call graph for this function:

◆ partialReverseSort()

void partialReverseSort ( label  n,
label  start = 0 
)

Definition at line 157 of file SortableList.C.

References Foam::ListOps::identity(), n, and List::transfer().

Here is the call graph for this function:

◆ swap()

void swap ( SortableList< T > &  other)
inline

Definition at line 177 of file SortableList.C.

◆ operator=() [1/6]

void operator= ( const T val)
inline

Definition at line 192 of file SortableList.C.

References UList::operator=().

Here is the call graph for this function:

◆ operator=() [2/6]

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

Definition at line 200 of file SortableList.C.

References List::operator=().

Here is the call graph for this function:

◆ operator=() [3/6]

void operator= ( const SortableList< T > &  lst)
inline

Definition at line 208 of file SortableList.C.

References SortableList::indices(), and List::operator=().

Here is the call graph for this function:

◆ operator=() [4/6]

void operator= ( List< T > &&  lst)
inline

Definition at line 221 of file SortableList.C.

References List::transfer().

Here is the call graph for this function:

◆ operator=() [5/6]

void operator= ( SortableList< T > &&  lst)
inline

Definition at line 229 of file SortableList.C.

References clear().

Here is the call graph for this function:

◆ operator=() [6/6]

void operator= ( std::initializer_list< T lst)
inline

Definition at line 242 of file SortableList.C.

References List::operator=(), and Foam::sort().

Here is the call graph for this function:

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