Add asserts to ox::fs::Ptr

This commit is contained in:
Gary Talent 2018-03-05 23:07:40 -06:00
parent b616d9c0f2
commit cfc95b2dd1

View File

@ -71,6 +71,7 @@ inline size_t Ptr<T, size_t>::offset() const {
template<typename T, typename size_t>
inline T *Ptr<T, size_t>::operator->() const {
ox_assert(valid(), "Invalid pointer access. (ox::fs::Ptr::operator->())");
return reinterpret_cast<T*>(m_dataStart + m_itemStart);
}
@ -89,6 +90,7 @@ inline Ptr<T, size_t>::operator size_t() const {
template<typename T, typename size_t>
inline T &Ptr<T, size_t>::operator*() const {
ox_assert(valid(), "Invalid pointer dereference. (ox::fs::Ptr::operator*())");
return *static_cast<T>(this);
}