Template Class scoped

Class Documentation

template<class T>
class util::scoped

A class for managing heap memory within a certain scope.

util::scoped number(new int(100));

Public Types

using element_type = T
using pointer = element_type*
using reference = element_type&

Public Functions

explicit scoped(pointer ptr = nullptr) noexcept

Constructs a scoped pointer from a given memory block.

~scoped()
scoped(scoped &&other)
scoped &operator=(scoped &&other)
scoped(const scoped&) = delete
scoped &operator=(const scoped&) = delete
reference operator*() const
pointer operator->() const
explicit operator bool() const noexcept
pointer release() noexcept
void reset(pointer ptr) noexcept
void swap(scoped &other) noexcept
pointer get() const