summaryrefslogtreecommitdiff
path: root/AK/IntrusiveDetails.h
blob: 180979b37395257011ab213e8816617033b9e318 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
 * Copyright (c) 2021, Ali Mohammad Pur <mpfard@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/NonnullRefPtr.h>

namespace AK::Detail {

template<typename T, typename Container>
struct SubstituteIntrusiveContainerType {
    using Type = Container;
};

template<typename T>
struct SubstituteIntrusiveContainerType<T, NonnullRefPtr<T>> {
    using Type = RefPtr<T>;
};

template<typename Container, bool _IsRaw>
struct SelfReferenceIfNeeded {
    Container reference = nullptr;
};
template<typename Container>
struct SelfReferenceIfNeeded<Container, true> {
};

}