Patch std.conv to allow emplace(ClassType* addr, [ClassType obj])
text/plain
1037
Comments
Comment #0 by b.helyer — 2011-02-03T06:44:31Z
import std.range;
void main()
{
auto a = new Object[10];
zip(a);
}
Results in the following error:
/usr/include/d/std/range.d(2814): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) does not match any function template declaration
/usr/include/d/std/range.d(2814): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) cannot deduce template function from argument types !()(Object*,Object)
/usr/include/d/std/range.d(2818): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) does not match any function template declaration
/usr/include/d/std/range.d(2818): Error: template std.conv.emplace(T,Args...) if (!is(T == class)) cannot deduce template function from argument types !()(Object*)
Comment #1 by kennytm — 2011-05-01T03:53:49Z
Created attachment 956
Patch std.conv to allow emplace(ClassType* addr, [ClassType obj])
The problem is std.conv.emplace cannot emplace a class-object T into a T* pointer, which is explicitly filtered out in several specializations. I don't know why. Here is a patch which simply add the required specializations. (I have not throughoutly checked if it breaks any unittests other than std.conv.)