inlib
1.2.0
|
Classes | |
class | item |
Functions | |
int | strlen_greater (char **a1, char **a2) |
int | strlen_lesser (char **a1, char **a2) |
void | strlen (std::vector< std::string > &a_text, bool a_increasing=true) |
template<class T > | |
void | sort (std::vector< T > &a_vec, bool a_increasing=true) |
void inlib::sort::sort | ( | std::vector< T > & | a_vec, |
bool | a_increasing = true |
||
) | [inline] |
Definition at line 73 of file sort.
{ unsigned int l = a_vec.size(); if(l<=1) return; item<T>* items = new item<T>[l]; {for(unsigned int i=0;i<l;i++) items[i].m_value = a_vec[i];} if(a_increasing) { ::qsort(items,(size_t)l,(size_t)sizeof(item<T>), (inlib_sort_func_t)item<T>::greater); } else { ::qsort(items,(size_t)l,(size_t)sizeof(item<T>), (inlib_sort_func_t)item<T>::lesser); } {for(unsigned int i=0;i<l;i++) a_vec[i] = items[i].m_value;} delete [] items; }
void inlib::sort::strlen | ( | std::vector< std::string > & | a_text, |
bool | a_increasing = true |
||
) | [inline] |
Definition at line 37 of file sort.
{ unsigned int linen = a_text.size(); if(linen<=1) return; char** lines = new char*[linen]; {for(unsigned int i=0;i<linen;i++) lines[i] = str_dup(a_text[i].c_str());} if(a_increasing) { ::qsort(lines,(size_t)linen,(size_t)sizeof(char*), (inlib_sort_func_t)strlen_greater); } else { ::qsort(lines,(size_t)linen,(size_t)sizeof(char*), (inlib_sort_func_t)strlen_lesser); } for(unsigned int i=0;i<linen;i++) { a_text[i] = lines[i]; str_del(lines[i]); } delete [] lines; }
int inlib::sort::strlen_greater | ( | char ** | a1, |
char ** | a2 | ||
) | [inline] |