Namespaces
Variants
Views
Actions

std::get_deleter

From cppreference.com
< cpp‎ | memory‎ | shared ptr
 
 
Memory management library
(exposition only*)
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
(until C++20*)
(until C++20*)

Garbage collector support (until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
 
 
Defined in header <memory>
template< class Deleter, class T >
Deleter* get_deleter( const std::shared_ptr<T>& p ) noexcept;
(since C++11)

Access to the p's deleter. If the shared pointer p owns a deleter of type cv-unqualified Deleter (e.g. if it was created with one of the constructors that take a deleter as a parameter), then returns a pointer to the deleter. Otherwise, returns a null pointer.

Contents

[edit] Parameters

p - a shared pointer whose deleter needs to be accessed

[edit] Return value

A pointer to the owned deleter or nullptr. The returned pointer is valid at least as long as there remains at least one