Something went wrong. Try again.
OpenMW is an open implementation of the Morrowind engine
Something went wrong. Try again.
643 B · 32 lines
C++
123456789101112131415161718192021222324252627282930313233#ifndef OPENMW_COMPONENTS_MISC_NOTNULLPTR_H#define OPENMW_COMPONENTS_MISC_NOTNULLPTR_H
#include <cassert>#include <cstddef>
namespace Misc{ template <class T> class NotNullPtr { public: constexpr NotNullPtr(T* value) noexcept : mValue(value) { assert(mValue != nullptr); }
NotNullPtr(std::nullptr_t) = delete;
constexpr operator T*() const noexcept { return mValue; }
constexpr T* operator->() const noexcept { return mValue; }
constexpr T& operator*() const noexcept { return *mValue; }
private: T* mValue; };}
#endif