1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2024-12-27 21:35:41 +00:00

Make SafeStackObject implicitly up-castable.

This commit is contained in:
King_DuckZ 2017-05-06 21:48:45 +01:00
parent cd1be59cfa
commit f5f19350ea

View file

@ -38,6 +38,8 @@ namespace curry {
SafeStackObject& operator= (const SafeStackObject& parOther) = delete;
operator Kakoune::SafePtr<T>&();
template <typename U>
operator Kakoune::SafePtr<U>();
T& operator*();
safe_ptr& operator->();
@ -84,6 +86,12 @@ namespace curry {
return m_obj_ptr;
}
template <typename T>
template <typename U>
SafeStackObject<T>::operator Kakoune::SafePtr<U>() {
return Kakoune::SafePtr<U>(&m_obj);
}
template <typename T>
T& SafeStackObject<T>::operator*() {
return *m_obj_ptr;