util/Manual: add static method Cast()

This commit is contained in:
Max Kellermann 2018-08-20 15:35:43 +02:00
parent 3fbb54e0a4
commit 5e2af15e94

View File

@ -62,6 +62,13 @@ public:
}
#endif
/**
* Cast a value reference to the containing Manual instance.
*/
static constexpr Manual<T> &Cast(T &value) {
return reinterpret_cast<Manual<T> &>(value);
}
template<typename... Args>
void Construct(Args&&... args) {
assert(!initialized);