Cannot deduce from type
Chris via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Sep 22 07:45:30 PDT 2014
Why is that?
import std.stdio, std.array
void main() {
auto output = appender!(string);
output ~= "world!";
// output.data.insertInPlace(0, "Hello, "); // Doesn't work
auto asString = output.data;
asString.insertInPlace(0, "Hello, "); // Works
writeln(asString); // prints "Hello, world!"
}
Error: template std.array.insertInPlace cannot deduce function
from argument types !()(string, int, string), candidates are:
.dvm/compilers/dmd-2.066.0/linux/bin/../../src/phobos/std/array.d(1031):
std.array.insertInPlace(T, U...)(ref T[] array, size_t
pos, U stuff) if (!isSomeString!(T[]) &&
allSatisfy!(isInputRangeOrConvertible!T, U) && U.length > 0)
.dvm/compilers/dmd-2.066.0/linux/bin/../../src/phobos/std/array.d(1097):
std.array.insertInPlace(T, U...)(ref T[] array, size_t
pos, U stuff) if (isSomeString!(T[]) &&
allSatisfy!(isCharOrStringOrDcharRange, U))
More information about the Digitalmars-d-learn
mailing list