Autoware.Auto
autoware::common::algorithm::QuickSorter< Container, RandomIt > Class Template Reference

Iterative quick sort implementation based on a stack. More...

#include <quick_sort.hpp>

Public Member Functions

 QuickSorter (QuickSorter const &)=delete
 
QuickSorteroperator= (QuickSorter const &)=delete
 
 QuickSorter (QuickSorter &&)=default
 
QuickSorteroperator= (QuickSorter &&)=default
 Move equals operator. More...
 
 QuickSorter ()=default
 Default constructor, do not reserve capacity for stack. More...
 
 QuickSorter (::std::size_t capacity)
 Construct and reserve capacity for stack. More...
 
template<typename Compare >
void sort (RandomIt first, RandomIt last, Compare comp) const
 Iterative quick sort implementation using a stack, sorts range [first, last) using the given comparison function. More...
 
void sort (RandomIt first, RandomIt last) const
 Iterative quick sort implementation using a stack, sorts range [first, last) using the default less operation. More...
 
void reserve (::std::size_t capacity)
 Reserves helper stack capacity for the iterative quick sort algorithm based on the capacity of the container to be sorted such that no heap allocation is done during the algorithm. More...
 
::std::size_t capacity () const
 Returns the maximum capacity that is allowed for a container to be sorted. More...
 

Detailed Description

template<typename Container, typename RandomIt = typename Container::iterator>
class autoware::common::algorithm::QuickSorter< Container, RandomIt >

Iterative quick sort implementation based on a stack.

Constructor & Destructor Documentation

◆ QuickSorter() [1/4]

template<typename Container , typename RandomIt = typename Container::iterator>
autoware::common::algorithm::QuickSorter< Container, RandomIt >::QuickSorter ( QuickSorter< Container, RandomIt > const &  )
delete

◆ QuickSorter() [2/4]

template<typename Container , typename RandomIt = typename Container::iterator>
autoware::common::algorithm::QuickSorter< Container, RandomIt >::QuickSorter ( QuickSorter< Container, RandomIt > &&  )
default

◆ QuickSorter() [3/4]

template<typename Container , typename RandomIt = typename Container::iterator>
autoware::common::algorithm::QuickSorter< Container, RandomIt >::QuickSorter ( )
default

Default constructor, do not reserve capacity for stack.

◆ QuickSorter() [4/4]

template<typename Container , typename RandomIt = typename Container::iterator>
autoware::common::algorithm::QuickSorter< Container, RandomIt >::QuickSorter ( ::std::size_t  capacity)
inlineexplicit

Construct and reserve capacity for stack.

Parameters
[in]capacity- The maximum capacity of the container to be sorted

Member Function Documentation

◆ capacity()

template<typename Container , typename RandomIt = typename Container::iterator>
::std::size_t autoware::common::algorithm::QuickSorter< Container, RandomIt >::capacity ( ) const
inline

Returns the maximum capacity that is allowed for a container to be sorted.

Returns
The maximum capacity that a container may have if it is to be sorted using this sorter.

◆ operator=() [1/2]

template<typename Container , typename RandomIt = typename Container::iterator>
QuickSorter& autoware::common::algorithm::QuickSorter< Container, RandomIt >::operator= ( QuickSorter< Container, RandomIt > &&  )
default

Move equals operator.

◆ operator=() [2/2]

template<typename Container , typename RandomIt = typename Container::iterator>
QuickSorter& autoware::common::algorithm::QuickSorter< Container, RandomIt >::operator= ( QuickSorter< Container, RandomIt > const &  )
delete

◆ reserve()

template<typename Container , typename RandomIt = typename Container::iterator>
void autoware::common::algorithm::QuickSorter< Container, RandomIt >::reserve ( ::std::size_t  capacity)
inline

Reserves helper stack capacity for the iterative quick sort algorithm based on the capacity of the container to be sorted such that no heap allocation is done during the algorithm.

Parameters
[in]capacity- The maximum capacity of the container to be sorted

◆ sort() [1/2]

template<typename Container , typename RandomIt = typename Container::iterator>
void autoware::common::algorithm::QuickSorter< Container, RandomIt >::sort ( RandomIt  first,
RandomIt  last 
) const
inline

Iterative quick sort implementation using a stack, sorts range [first, last) using the default less operation.

Parameters
[in]firstStart of the range to sort
[in]lastEnd of the range to sort (not included)

◆ sort() [2/2]

template<typename Container , typename RandomIt = typename Container::iterator>
template<typename Compare >
void autoware::common::algorithm::QuickSorter< Container, RandomIt >::sort ( RandomIt  first,
RandomIt  last,
Compare  comp 
) const
inline

Iterative quick sort implementation using a stack, sorts range [first, last) using the given comparison function.

Parameters
[in]firstStart of the range to sort
[in]lastEnd of the range to sort (not included)
[in]compThe comparison function to base the sorting on

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