std.string and std.algorithm: what to do?

Derek Parnell derek at psych.ward
Thu May 14 15:15:01 PDT 2009


On Thu, 14 May 2009 17:33:40 -0400, Steven Schveighoffer wrote:

> On Thu, 14 May 2009 17:21:02 -0400, Derek Parnell <derek at psych.ward> wrote:
 
> Not really.  What could funcA possibly do with the index without the  
> string itself?  If it's just a flag (uint.max or not), then funcA should  
> be:
> 
> funcA(bool found, ...)
> 
> and you call it with
> 
> funcA(find(needle, haystack) < haystack.length, xyzzy)
> 
> This doesn't cause any problems with people who use Tango, which returns  
> the length if not found.  In other words, if you find yourself writing  
> code to "morph" the length into uint.max or -1, you are thinking about the  
> problem incorrectly.

Who said that I had control of how funcA() was implemented?

-- 
Derek Parnell
Melbourne, Australia
skype: derek.j.parnell



More information about the Digitalmars-d mailing list