Issue 1323
Tomek Sowiński
just at ask.me
Sun Jan 9 05:28:50 PST 2011
bearophile napisał:
> > Also, IMO, it has no real advantage, why not use std.algorithm.find instead ?
>
> The syntax is worse, I don't like to call a function for something so common and basic. It's like calling a library
> function to join two strings (and find("hello", "llox") doesn't return a boolean).
That can be pretty much solved with a wrapper:
bool has(alias pred = "a == b", R, E)(R haystack, E needle) {
return find(haystack, needle).empty;
}
-------
if (someString.has(c))
...
Can we add 'has' (or call it 'contains', I don't mind) to std.algorithm and end the discussion?
--
Tomek
More information about the Digitalmars-d
mailing list