BRICKS
Small, useful blocks of code, to build bigger things.
Loading...
Searching...
No Matches
handle.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
5namespace bricks {
6
12template <typename T, auto fn>
13struct deleter {
14 void operator()(T* p) { fn(p); }
15};
16
25template <typename T, auto fn>
26using handle = std::unique_ptr<T, deleter<T, fn>>;
27
28} // namespace bricks
Definition algorithm.hpp:12
std::unique_ptr< T, deleter< T, fn > > handle
A handle is a unique_ptr with a custom deleter.
Definition handle.hpp:26
A deleter is a function that deletes a pointer.
Definition handle.hpp:13
void operator()(T *p)
Definition handle.hpp:14