On Wednesday, 20 January 2021 at 13:11:09 UTC, Paul Backus wrote:
On Wednesday, 20 January 2021 at 04:43:12 UTC, frame wrote:
struct foo(T) {
T get() {
static if (is(T : bar)) {
if (value is null) {
value = fun!T;
Error: template instance `fun!T` template `fun` is not defined
Please post an example with enough code to actually produce the
error you're seeing.
I don't know when to stop posting code then :(
fun!T just returns bar or null. Manually calling works.
but if it helps, here is fun!T:
TDobj fun(TDobj, T)(string propertyName, T needle) if (is(TDobj :
bar)) {
TDobj[] list = loadAllMatched!TDobj(propertyName, needle, 1);
return list.length > 0 ? list[0] : null;
}
and actually called
value = fun!T("id", 123));
It also compiles if
value = new T