Lagrange
default_delete.h
1// Source: https://github.com/X-czh/smart_ptr
2// SPDX-License-Identifier: MIT
3//
4// This file has been modified by Adobe.
5//
6// All modifications are Copyright 2022 Adobe.
7
8// default_delete is the default destruction policy used by
9// unique_ptr & shared_ptr when no deleter is specified.
10
11#pragma once
12
13namespace lagrange::internal {
14
15// 20.7.1.1 Default deleters
16
17// 20.7.1.1.2, default_delete
18
19template <typename T>
21{
22public:
24 constexpr default_delete() noexcept = default;
25
27 template <typename U>
28 default_delete(const default_delete<U>&) noexcept
29 {}
30
32 void operator()(T* p) const { delete p; }
33};
34
35// 20.7.1.1.3, default_delete<T[]>
36
37template <typename T>
39{
40public:
42 constexpr default_delete() noexcept = default;
43
45 template <typename U>
46 default_delete(const default_delete<U[]>&) noexcept
47 {}
48
50 void operator()(T* p) const { delete[] p; }
51};
52
53} // namespace lagrange::internal
constexpr default_delete() noexcept=default
Default constructor.
void operator()(T *p) const
Call operator.
Definition: default_delete.h:50
Definition: default_delete.h:21
constexpr default_delete() noexcept=default
Default constructor.
void operator()(T *p) const
Call operator.
Definition: default_delete.h:32
nullptr_t, size_t, ptrdiff_t basic_ostream bad_weak_ptr extent, remove_extent, is_array,...
Definition: attribute_string_utils.h:21