NEURON
neuron::alloc_deleter< Alloc > Struct Template Reference

Allocator-aware deleter for use with std::unique_ptr. More...

#include <memory.h>

Public Types

using pointer = typename std::allocator_traits< Alloc >::pointer
 

Public Member Functions

 alloc_deleter ()=default
 
 alloc_deleter (const Alloc &a)
 
void operator() (pointer p) const
 

Private Attributes

Alloc a
 

Detailed Description

template<typename Alloc>
struct neuron::alloc_deleter< Alloc >

Allocator-aware deleter for use with std::unique_ptr.

This is copied from https://stackoverflow.com/a/23132307. See also http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0316r0.html, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p0211r3.html, and boost::allocate_unique<...>. Hopefully std::allocate_unique will be included in C++23.

Definition at line 89 of file memory.h.

Member Typedef Documentation

◆ pointer

template<typename Alloc >
using neuron::alloc_deleter< Alloc >::pointer = typename std::allocator_traits<Alloc>::pointer

Definition at line 94 of file memory.h.

Constructor & Destructor Documentation

◆ alloc_deleter() [1/2]

template<typename Alloc >
neuron::alloc_deleter< Alloc >::alloc_deleter ( )
default

◆ alloc_deleter() [2/2]

template<typename Alloc >
neuron::alloc_deleter< Alloc >::alloc_deleter ( const Alloc &  a)
inline

Definition at line 91 of file memory.h.

Member Function Documentation

◆ operator()()

template<typename Alloc >
void neuron::alloc_deleter< Alloc >::operator() ( pointer  p) const
inline

Definition at line 96 of file memory.h.

Member Data Documentation

◆ a

template<typename Alloc >
Alloc neuron::alloc_deleter< Alloc >::a
private

Definition at line 103 of file memory.h.


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