Fixing std.string

Jonathan M Davis jmdavisprog at gmail.com
Tue Aug 24 01:23:46 PDT 2010


On Monday 23 August 2010 23:16:25 Michael Rynn wrote:
> The problems are combinatorial, because of encoding schemes.
> I imagine that when someone wants a function that is missing from
> std.string, they might write one, and might even add to it.

A lot of functions in Phobos are templated on string type, so you don't have to 
define multiple versions of them. Very few, if any, are actually defined for 
multiple string types. Now, because each template instantiation results in 
another version of the function in the resulting binary, if you try and use all 
of the functions with all of the string types, then you do get combinatorial 
problems. But thanks to the templates, you don't have to worry about it 
directly, and it's not like it's going to be a typical use case for most string 
functions to be used by multiple string types in the same program. It will 
happen, but not enough to generally be an issue.

- Jonathan M Davis


More information about the Digitalmars-d mailing list