Add an into_dyn helper function to C++ VRc

This will be used in more places in the future, so centralize the ugly re-interpret cast.
This commit is contained in:
Simon Hausmann 2020-11-18 15:00:52 +01:00
parent 8b76114083
commit 9c998c9e56
2 changed files with 4 additions and 3 deletions

View file

@ -118,6 +118,8 @@ public:
const X& operator*() const {
return inner->data;
}
VRc<VTable, Dyn> into_dyn() const { return *reinterpret_cast<const VRc<VTable, Dyn> *>(this); }
};
template<typename VTable, typename X = Dyn>