At

https://github.com/nordlow/phobos-next/blob/master/src/moval.d

I've implemented a helper function for creating r-value out of l-values defined as

E movedToRvalue(E)(ref E e)
{
    import std.algorithm.mutation : move;
    E value;
    move(e, value);             // this can be optimized
    return value;
}

For the case when movedToRvalue is called with an r-value, such as in,

    static assert(__traits(compiles, { consume(S(14)); }));

I would like to overload to an identity op.

Is this currently possible somehow? I cannot find any trait `isRvalue` that fulfills

    static assert(isRvalue!(S(14)));

Is there one?

Reply via email to