digitalmars.D.learn - appender!(string[]).put(string) doesn't work
- David Held (20/20) Feb 08 2015 auto data = appender!(string[]);
- David Held (6/10) Feb 08 2015 Never mind. someString is actually the result of stdin.byLine(), which
auto data = appender!(string[]); ... data.put(someString); source\colony.d(360): Error: template std.array.Appender(string[]).Appender.put does not match any function template declaration. Candidates are: D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(2251): std.array.Appender!(string[]).Appender.put(U)(U item) if (canPutItem!U) D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(2279): std.array.Appender!(string[]).Appender.put(Range)(Range items) if (canPutConstRange!Range) D:\D\dmd2\windows\bin\..\..\src\phobos\std\array.d(2288): std.array.Appender!(string[]).Appender.put(Range)(Range items) if (canPutRange!Range) source\colony.d(360): Error: template std.array.Appender!(string[]).Appender.put(U)(U item) if (canPutItem!U) cannot deduce template function from argument types !()(char[]) The example in the documentation implies that this should work fine. What am I missing? Dave
Feb 08 2015
On 2/8/2015 4:09 PM, David Held wrote:auto data = appender!(string[]); ... data.put(someString); [...]Never mind. someString is actually the result of stdin.byLine(), which returns a char[], not a string. I didn't notice this until just now. .idup fixes this just fine (although, I suppose changing it to char[][] might be even better). Dave
Feb 08 2015