Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
UniqueMallocOwner< X > Class Template Reference

#include "lib/unique-malloc-owner.hpp"

Description

template<class X = void>
class lib::UniqueMallocOwner< X >

Ownership token for a piece of heap memory allocated in plain-C style.

This smart ptr takes ownership of the memory given at construction, to make sure it is deallocated properly with free(void*). Ownership can be transferred by move semantics.

Remarks
std::free is installed as deleter function, which means we're carrying along an additional pointer

Definition at line 48 of file unique-malloc-owner.hpp.

Public Member Functions

 UniqueMallocOwner (void *memory=nullptr)
 
 UniqueMallocOwner (X *alloc)
 
bool empty () const
 

Private Types

using _Parent = std::unique_ptr< X, void(*)(void *)>
 

Constructor & Destructor Documentation

◆ UniqueMallocOwner() [1/2]

template<class X = void>
UniqueMallocOwner ( void *  memory = nullptr)
inlineexplicit

Definition at line 55 of file unique-malloc-owner.hpp.

◆ UniqueMallocOwner() [2/2]

template<class X = void>
UniqueMallocOwner ( X *  alloc)
inlineexplicit

Definition at line 60 of file unique-malloc-owner.hpp.

Member Typedef Documentation

◆ _Parent

template<class X = void>
using _Parent = std::unique_ptr<X, void(*)(void*)>
private

Definition at line 51 of file unique-malloc-owner.hpp.

Member Function Documentation

◆ empty()

template<class X = void>
bool empty ( ) const
inline

Definition at line 66 of file unique-malloc-owner.hpp.

+ Inheritance diagram for UniqueMallocOwner< X >:
+ Collaboration diagram for UniqueMallocOwner< X >:

The documentation for this class was generated from the following file: