On 5/19/16 10:43 AM, Steven Schveighoffer wrote:

Or even better:

template(T) foo if (someConstraints)
{
    struct Result
    {
       T t;
    }

    auto foo(T t)
    {
       return Result(t);
    }
}

This solution works awesomely, actually. It even produces smaller code than moving the struct completely outside.

I'm going to use this mechanism in iopipe to get my voldemorts back :)

-Steve

Reply via email to