guanaqo main
Utilities for scientific software
Loading...
Searching...
No Matches
noop-delete.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file
4/// @ingroup memory
5/// Deleter that skips deallocation.
6
7namespace guanaqo {
8
9/// Deleter for `std::unique_ptr` that just destructs the object, without
10/// deallocating.
11/// @ingroup memory
12template <class T>
14 constexpr noop_delete() noexcept = default;
15 template <class U>
16 constexpr noop_delete(const noop_delete<U> &) noexcept {}
17 constexpr void operator()(T *t) const noexcept { t->~T(); }
18};
19
20} // namespace guanaqo
constexpr noop_delete() noexcept=default
constexpr void operator()(T *t) const noexcept