\hypertarget{class_ogre_1_1_radix_sort}{}\doxysection{Ogre\+::Radix\+Sort$<$ T\+Container, T\+Container\+Value\+Type, T\+Comp\+Value\+Type $>$ Class Template Reference}
\label{class_ogre_1_1_radix_sort}\index{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}}


Class for performing a radix sort (fast comparison-\/less sort based on byte value) on various standard S\+TL containers.  




{\ttfamily \#include $<$Ogre\+Radix\+Sort.\+h$>$}

\doxysubsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef T\+Container\+::iterator \mbox{\hyperlink{class_ogre_1_1_radix_sort_ae6832006de9925d59d8795d4f708f08f}{Container\+Iter}}
\end{DoxyCompactItemize}
\doxysubsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{class_ogre_1_1_radix_sort_a2c982200600a22b21906e3f43a0a962d}{Radix\+Sort}} ()
\item 
\mbox{\hyperlink{class_ogre_1_1_radix_sort_a8f49cae4360e7c83b6ca7cf5714db761}{$\sim$\+Radix\+Sort}} ()
\item 
{\footnotesize template$<$class T\+Function $>$ }\\void \mbox{\hyperlink{class_ogre_1_1_radix_sort_a4fc283b678dfda772eb6600436d97579}{sort}} (T\+Container \&container, T\+Function func)
\begin{DoxyCompactList}\small\item\em Main sort function. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
\subsubsection*{template$<$class T\+Container, class T\+Container\+Value\+Type, typename T\+Comp\+Value\+Type$>$\newline
class Ogre\+::\+Radix\+Sort$<$ T\+Container, T\+Container\+Value\+Type, T\+Comp\+Value\+Type $>$}

Class for performing a radix sort (fast comparison-\/less sort based on byte value) on various standard S\+TL containers. 

\begin{DoxyRemark}{Remarks}
A radix sort is a very fast sort algorithm. It doesn\textquotesingle{}t use comparisons and thus is able to break the theoretical minimum O(\+N$\ast$log\+N) complexity. Radix sort is complexity O(k$\ast$\+N), where k is a constant. Note that radix sorting is not in-\/place, it requires additional storage, so it trades memory for speed. The overhead of copying means that it is only faster for fairly large datasets, so you are advised to only use it for collections of at least a few hundred items. 
\end{DoxyRemark}
\begin{DoxyParagraph}{}
This is a template class to allow it to deal with a variety of containers, and a variety of value types to sort on. In addition to providing the container and value type on construction, you also need to supply a functor object which will retrieve the value to compare on for each item in the list. For example, if you had an std\+::vector of by-\/value instances of an object of class \textquotesingle{}Bibble\textquotesingle{}, and you wanted to sort on Bibble\+::get\+Doobrie(), you\textquotesingle{}d have to firstly create a functor like this\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keyword}{struct }BibbleSortFunctor}
\DoxyCodeLine{\{}
\DoxyCodeLine{    \textcolor{keywordtype}{float} operator()(\textcolor{keyword}{const} Bibble\& val)\textcolor{keyword}{ const}}
\DoxyCodeLine{\textcolor{keyword}{    }\{}
\DoxyCodeLine{        \textcolor{keywordflow}{return} val.getDoobrie();}
\DoxyCodeLine{    \}}
\DoxyCodeLine{\}}
\end{DoxyCode}
 Then, you need to declare a \mbox{\hyperlink{class_ogre_1_1_radix_sort}{Radix\+Sort}} class which names the container type, the value type in the container, and the type of the value you want to sort by. You can then call the sort function. E.\+g. 
\begin{DoxyCode}{0}
\DoxyCodeLine{RadixSort<BibbleList, Bibble, float> radixSorter;}
\DoxyCodeLine{BibbleSortFunctor functor;}
\DoxyCodeLine{}
\DoxyCodeLine{radixSorter.sort(myBibbleList, functor);}
\end{DoxyCode}
 You should try to reuse \mbox{\hyperlink{class_ogre_1_1_radix_sort}{Radix\+Sort}} instances, since repeated allocation of the internal storage is then avoided. 
\end{DoxyParagraph}
\begin{DoxyNote}{Note}
Radix sorting is often associated with just unsigned integer values. Our implementation can handle both unsigned and signed integers, as well as floats (which are often not supported by other radix sorters). doubles are not supported; you will need to implement your functor object to convert to float if you wish to use this sort routine. 
\end{DoxyNote}


\doxysubsection{Member Typedef Documentation}
\mbox{\Hypertarget{class_ogre_1_1_radix_sort_ae6832006de9925d59d8795d4f708f08f}\label{class_ogre_1_1_radix_sort_ae6832006de9925d59d8795d4f708f08f}} 
\index{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}!ContainerIter@{ContainerIter}}
\index{ContainerIter@{ContainerIter}!Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}}
\doxysubsubsection{\texorpdfstring{ContainerIter}{ContainerIter}}
{\footnotesize\ttfamily template$<$class T\+Container, class T\+Container\+Value\+Type, typename T\+Comp\+Value\+Type$>$ \\
typedef T\+Container\+::iterator \mbox{\hyperlink{class_ogre_1_1_radix_sort}{Ogre\+::\+Radix\+Sort}}$<$ T\+Container, T\+Container\+Value\+Type, T\+Comp\+Value\+Type $>$\+::\mbox{\hyperlink{class_ogre_1_1_radix_sort_ae6832006de9925d59d8795d4f708f08f}{Container\+Iter}}}



\doxysubsection{Constructor \& Destructor Documentation}
\mbox{\Hypertarget{class_ogre_1_1_radix_sort_a2c982200600a22b21906e3f43a0a962d}\label{class_ogre_1_1_radix_sort_a2c982200600a22b21906e3f43a0a962d}} 
\index{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}!RadixSort@{RadixSort}}
\index{RadixSort@{RadixSort}!Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}}
\doxysubsubsection{\texorpdfstring{RadixSort()}{RadixSort()}}
{\footnotesize\ttfamily template$<$class T\+Container, class T\+Container\+Value\+Type, typename T\+Comp\+Value\+Type$>$ \\
\mbox{\hyperlink{class_ogre_1_1_radix_sort}{Ogre\+::\+Radix\+Sort}}$<$ T\+Container, T\+Container\+Value\+Type, T\+Comp\+Value\+Type $>$\+::\mbox{\hyperlink{class_ogre_1_1_radix_sort}{Radix\+Sort}} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}

\mbox{\Hypertarget{class_ogre_1_1_radix_sort_a8f49cae4360e7c83b6ca7cf5714db761}\label{class_ogre_1_1_radix_sort_a8f49cae4360e7c83b6ca7cf5714db761}} 
\index{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}!````~RadixSort@{$\sim$RadixSort}}
\index{````~RadixSort@{$\sim$RadixSort}!Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}}
\doxysubsubsection{\texorpdfstring{$\sim$RadixSort()}{~RadixSort()}}
{\footnotesize\ttfamily template$<$class T\+Container, class T\+Container\+Value\+Type, typename T\+Comp\+Value\+Type$>$ \\
\mbox{\hyperlink{class_ogre_1_1_radix_sort}{Ogre\+::\+Radix\+Sort}}$<$ T\+Container, T\+Container\+Value\+Type, T\+Comp\+Value\+Type $>$\+::$\sim$\mbox{\hyperlink{class_ogre_1_1_radix_sort}{Radix\+Sort}} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



\doxysubsection{Member Function Documentation}
\mbox{\Hypertarget{class_ogre_1_1_radix_sort_a4fc283b678dfda772eb6600436d97579}\label{class_ogre_1_1_radix_sort_a4fc283b678dfda772eb6600436d97579}} 
\index{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}!sort@{sort}}
\index{sort@{sort}!Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$@{Ogre::RadixSort$<$ TContainer, TContainerValueType, TCompValueType $>$}}
\doxysubsubsection{\texorpdfstring{sort()}{sort()}}
{\footnotesize\ttfamily template$<$class T\+Container, class T\+Container\+Value\+Type, typename T\+Comp\+Value\+Type$>$ \\
template$<$class T\+Function $>$ \\
void \mbox{\hyperlink{class_ogre_1_1_radix_sort}{Ogre\+::\+Radix\+Sort}}$<$ T\+Container, T\+Container\+Value\+Type, T\+Comp\+Value\+Type $>$\+::sort (\begin{DoxyParamCaption}\item[{T\+Container \&}]{container,  }\item[{T\+Function}]{func }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Main sort function. 


\begin{DoxyParams}{Parameters}
{\em container} & A container of the type you declared when declaring \\
\hline
{\em func} & A functor which returns the value for comparison when given a container value \\
\hline
\end{DoxyParams}


The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{_ogre_radix_sort_8h}{Ogre\+Radix\+Sort.\+h}}\end{DoxyCompactItemize}
