Add opCast(bool) to FreeListRef and remove opAssign with value type.
This commit is contained in:
parent
ecd981b1e1
commit
b68d23f515
|
@ -1143,7 +1143,7 @@ Future!(ReturnType!CALLABLE) async(CALLABLE, ARGS...)(CALLABLE callable, ARGS ar
|
||||||
Future!RET ret;
|
Future!RET ret;
|
||||||
ret.init();
|
ret.init();
|
||||||
static void compute(FreeListRef!(shared(RET)) dst, CALLABLE callable, ARGS args) {
|
static void compute(FreeListRef!(shared(RET)) dst, CALLABLE callable, ARGS args) {
|
||||||
dst = cast(shared(RET))callable(args);
|
dst.get = cast(shared(RET))callable(args);
|
||||||
}
|
}
|
||||||
static if (isWeaklyIsolated!CALLABLE && isWeaklyIsolated!ARGS) {
|
static if (isWeaklyIsolated!CALLABLE && isWeaklyIsolated!ARGS) {
|
||||||
ret.m_task = runWorkerTaskH(&compute, ret.m_result, callable, args);
|
ret.m_task = runWorkerTaskH(&compute, ret.m_result, callable, args);
|
||||||
|
|
|
@ -133,6 +133,8 @@ struct FreeListRef(T, bool INIT = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool opCast(T)() const if (is(T == bool)) { return m_object !is null; }
|
||||||
|
|
||||||
void opAssign(FreeListRef other)
|
void opAssign(FreeListRef other)
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
|
@ -159,7 +161,6 @@ struct FreeListRef(T, bool INIT = true)
|
||||||
@property inout(T) get() inout @safe nothrow { return m_object; }
|
@property inout(T) get() inout @safe nothrow { return m_object; }
|
||||||
} else {
|
} else {
|
||||||
@property ref inout(T) get() inout @safe nothrow { return *m_object; }
|
@property ref inout(T) get() inout @safe nothrow { return *m_object; }
|
||||||
void opAssign(T t) { *m_object = t; }
|
|
||||||
}
|
}
|
||||||
alias get this;
|
alias get this;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue