From 5e2af15e94fa80bbe68ede1231181ea1bc5c0e71 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 20 Aug 2018 15:35:43 +0200 Subject: [PATCH] util/Manual: add static method Cast() --- src/util/Manual.hxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/util/Manual.hxx b/src/util/Manual.hxx index 71a945427..b6ad7d072 100644 --- a/src/util/Manual.hxx +++ b/src/util/Manual.hxx @@ -62,6 +62,13 @@ public: } #endif + /** + * Cast a value reference to the containing Manual instance. + */ + static constexpr Manual &Cast(T &value) { + return reinterpret_cast &>(value); + } + template void Construct(Args&&... args) { assert(!initialized);