Standard library » Containers » Unique pointer module

Contents

A std::unique_ptr like container.

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

Files

file bn_memory.h

Classes

template<typename Type>
struct bn::default_delete
Default deleter.
template<typename Type, typename Deleter = default_delete<Type>>
class bn::unique_ptr
std::shared_ptr like smart pointer that owns and manages another object through a pointer and disposes of that object when the unique_ptr goes out of scope.
template<typename Type, typename Deleter>
struct bn::hash<unique_ptr<Type, Deleter>>
Hash support for unique_ptr.

Functions

template<typename Type, class... Args>
auto make_unique(Args && ... args) -> unique_ptr<Type>
Constructs an object and wraps it in a unique_ptr.

Function documentation

#include <bn_memory.h>
template<typename Type, class... Args>
unique_ptr<Type> make_unique(Args && ... args)

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.