Add non-ref overload of get().
This commit is contained in:
parent
4a506f458b
commit
e4c5ec700a
|
@ -609,6 +609,13 @@ ref inout(T) get(T, U)(ref inout(TaggedAlgebraic!U) ta)
|
|||
assert(hasType!(T, U)(ta), () { scope (failure) assert(false); return format("Trying to get %s but have %s.", T.stringof, ta.kind); } ());
|
||||
return ta.trustedGet!T;
|
||||
}
|
||||
/// ditto
|
||||
inout(T) get(T, U)(inout(TaggedAlgebraic!U) ta)
|
||||
{
|
||||
import std.format : format;
|
||||
assert(hasType!(T, U)(ta), () { scope (failure) assert(false); return format("Trying to get %s but have %s.", T.stringof, ta.kind); } ());
|
||||
return ta.trustedGet!T;
|
||||
}
|
||||
|
||||
/// Convenience type that can be used for union fields that have no value (`void` is not allowed).
|
||||
struct Void {}
|
||||
|
|
Loading…
Reference in a new issue