Standard library » Containers » Unique pointer module

std::unique_ptr like container.

It doesn't throw exceptions. Instead, asserts are used to ensure valid usage.

Unlike most Butano containers, it uses the heap instead of the stack.

Files

file bn_unique_ptr.h
file bn_unique_ptr_fwd.h

Classes

template<typename Type, typename Deleter>
struct bn::hash<unique_ptr<Type, Deleter>>
Hash support for unique_ptr.
template<typename Type, typename Deleter = default_delete<Type>>
class bn::unique_ptr
std::unique_ptr like container.

Functions

template<typename Type, class... Args>
auto make_unique(Args && ... args) -> unique_ptr<Type> constexpr
Constructs an object and wraps it in a unique_ptr.
template<typename Type, typename Deleter>
auto operator<<(ostringstream& stream, const unique_ptr<Type, Deleter>& value) -> ostringstream&
Appends the character representation of the given unique_ptr to the given ostringstream.

Function documentation

template<typename Type, class... Args>
unique_ptr<Type> make_unique(Args && ... args) constexpr

Constructs an object and wraps it in a unique_ptr.

Template parameters
Type Type of the object to construct.
Args Type of the arguments of the object to construct.
Parameters
args Parameters of the object to construct.
Returns A unique_ptr managing the new object.

template<typename Type, typename Deleter>
ostringstream& operator<<(ostringstream& stream, const unique_ptr<Type, Deleter>& value)

Appends the character representation of the given unique_ptr to the given ostringstream.

Template parameters
Type Type of the managed object.
Deleter Type of the object which disposes the managed object when the unique_ptr goes out of scope.