Commit 88f3a85c authored by Kenton Varda's avatar Kenton Varda Committed by Kenton Varda

OneOf::init() should return a reference to the initialized value.

parent 617481a0
......@@ -74,10 +74,11 @@ public:
}
template <typename T, typename... Params>
void init(Params&&... params) {
T& init(Params&&... params) {
if (tag != 0) destroy();
ctor(*reinterpret_cast<T*>(space), kj::fwd<Params>(params)...);
tag = typeIndex<T>();
return *reinterpret_cast<T*>(space);
}
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment