std.algorithm issue

bearophile bearophileHUGS at lycos.com
Thu May 22 14:25:36 PDT 2008


Brian Myers:
>     string Merge(string f1, string f2) {
>     .
>     .
>     .
>     }

I don't exactly know what you are trying to do, but using s1~s2 to merge an array of strings is probably O(n^2) if the higher order functions you use (or the compiler) aren't smart enough.
There is a join() function in std.string that is O(1), and there's a faster version of it in my libs (and probably in Tango too).

Bye,
bearophile



More information about the Digitalmars-d mailing list