Ranges of char and wchar

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu May 8 15:33:56 PDT 2014


On 5/8/14, 10:46 AM, Andrei Alexandrescu wrote:
[snip]

Here's a list of algorithms in std.algorithm that would need to be 
looked at if we want to handle ranges of char and wchar properly (at 
least versions with predicates). When I say "looked at" I mean "modified 
appropriately to handle ranges of char and wchar in addition to strings".

========================

Searching: all  any  canFind  count  countUntil  commonPrefix  endsWith 
  find  findAdjacent  findAmong  findSkip  findSplit  findSplitAfter 
findSplitBefore  minCount  minPos  mismatch  skipOver  startsWith  until

Comparison: cmp  equal  levenshteinDistance  levenshteinDistanceAndPath 
  mismatch

Iteration: filter  filterBidirectional  group  map  reduce  splitter  uniq

Sorting: completeSort  isPartitioned  isSorted  makeIndex 
nextPermutation  nextEvenPermutation  partialSort  partition  partition3 
  schwartzSort  sort  topN  topNCopy

Set operations: (probably none, because set ops are rare on strings)

Mutation: bringToFront  copy  fill  initializeAll  moveAll  moveSome 
remove  reverse  strip  stripLeft  stripRight  swapRanges  uninitializedFill

========================

Of these, only a fraction (maybe 60-70%) are actually used with strings. 
Still that leaves a significant amount of work to do if we want 
std.algorithm to work smoothly with ranges of char/wchar. Here 
"smoothly" means "if it compiles and runs it won't do something UTF-goofy".



Andrei



More information about the Digitalmars-d mailing list