2 #ifndef SYDEVS_POINTER_H_
3 #define SYDEVS_POINTER_H_
38 explicit pointer(std::nullptr_t X) noexcept;
52 void reset() noexcept;
60 explicit operator bool()
const noexcept;
63 std::shared_ptr<void> ptr_;
102 if (!ptr_)
throw std::logic_error(
"Attempt to dereference null pointer object");
103 return *
static_cast<T*
>(ptr_.get());
107 inline pointer::operator
bool() const noexcept
T & dereference() const
Returns the referenced data, casting it to type T.
Definition: pointer.h:100
pointer() noexcept
Constructs a null pointer instance.
Definition: pointer.h:67
pointer & operator=(const pointer &) noexcept=default
Copy assignment.
~pointer()=default
Destructor.
void reset() noexcept
Modifies the pointer to reference nullptr.
Definition: pointer.h:86
A data type which represents a pointer to anything.
Definition: pointer.h:27