SList of chars not possible?

Simen Kjaeraas simen.kjaras at gmail.com
Fri Nov 2 01:22:18 PDT 2012


On 2012-18-01 23:11, They call me Mr. D <kheaser at eapl.org> wrote:

>
> auto i = SList!int(1, 2, 3, 4, 5, 6, 7);
>
> auto f = SList!float(1.1, 2.234, 3.21, 4.3, 5.001, 6.2, 7.0);
>
> auto s = SList!string(["I", "Hello", "World"]);
>
> auto c = SList!char('a', 'b' ,'c');  // doesn't compile, get the  
> following
>
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\container.d(905): Error:  
> template std.container.SList!(char).SList.insertFront does not match any  
> function template
> eclaration
> C:\D\dmd2\windows\bin\..\..\src\phobos\std\container.d(1096): Error:  
> template std.container.SList!(char).SList.insertFront cannot deduce  
> template function from
> argument types !()(char[])
> Container.d(19): Error: template instance  
> std.container.SList!(char).SList.__ctor!(char) error instantiating
>
> auto c = SList!char(['a', 'b' ,'c']); // doesn't compile either.
>
>
> Seems to me a Slist of char nodes should be pretty innocuous.

Not sure of the exact reasons, but I think Ali is probably right.

A char cannot hold all possible values for a unicode character, so
having a range with that element type is not really a good idea.

-- 
Simen


More information about the Digitalmars-d-learn mailing list