ADS
Algorithms and Data Structures
Loading...
Searching...
No Matches
StringSort.h
Go to the documentation of this file.
1/*--------------------------------------------------------------------------*/
2/*--------------------------- File StringSort.h ----------------------------*/
3/*--------------------------------------------------------------------------*/
68/*--------------------------------------------------------------------------*/
69/*----------------------------- DEFINITIONS --------------------------------*/
70/*--------------------------------------------------------------------------*/
71
72#ifndef __ADS_StringSort
73 #define __ADS_StringSort
74/* self-identification: #endif constant */
75
76/*--------------------------------------------------------------------------*/
77/*------------------------------ INCLUDES ----------------------------------*/
78/*--------------------------------------------------------------------------*/
79
80#include "ADS/Contract.h"
81#include "ADS/Portable.h"
82#include "ADS/sort/Sorted.h"
84
85#include <algorithm>
86#include <bit>
87#include <cstddef>
88#include <cstdint>
89#include <cstring>
90#include <memory>
91#include <new>
92#include <string>
93#include <string_view>
94#include <utility>
95#include <vector>
96
97/*--------------------------------------------------------------------------*/
98/*--------------------------- NAMESPACE ------------------------------------*/
99/*--------------------------------------------------------------------------*/
100
101namespace ADS
102{
103
133template< StringStore Store >
134void prefixKeySort( Store && A );
135
137inline void prefixKeySort( std::vector< std::string > & A );
138
139/*--------------------------------------------------------------------------*/
140/*------------------------- THE SORTS OF A RANGE ---------------------------*/
141/*--------------------------------------------------------------------------*/
142
147template< SortRange R , class... P >
148 requires requires( std::vector< std::ranges::range_value_t< R > > & v ,
149 P &&... p )
150{
151 prefixKeySort( v , std::forward< P >( p )... );
152 }
153decltype( auto ) prefixKeySort( R && A , P &&... p )
154{
155 const auto f = [ & ]( auto & v ) -> decltype( auto ) {
156 return( prefixKeySort( v , std::forward< P >( p )... ) );
157 };
158 return( detail::sortRange( A , f ) );
159 }
160
161/*--------------------------------------------------------------------------*/
162
163} // end( namespace ADS )
164
165/*--------------------------------------------------------------------------*/
166/*-------------------------- IMPLEMENTATION --------------------------------*/
167/*--------------------------------------------------------------------------*/
168
169#include "ADS/sort/impl/StringSort.tpp"
170
171/*--------------------------------------------------------------------------*/
172
173#endif /* StringSort.h included */
174
175/*--------------------------------------------------------------------------*/
176/*-------------------------- End File StringSort.h -------------------------*/
177/*--------------------------------------------------------------------------*/
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The primitives of the processor that the compilers spell each in their own way, in one form for all: ...
The checks of the contracts of the sorts [see Contract.h]: a copy of the input kept only when the aud...
The quicksort in the lanes of the vector registers, beyond the book: vectorQuickSort() sorts integers...
a range that the sorts take beside std::vector and std::span: random access, sized,...
Definition Sorted.h:153
void prefixKeySort(Store &&A)
the stable sort of strings by integer keys of their prefixes
Definition ADT.h:96