blob: 73a56f9085ffc53972ac4401df302d895e61f7e3 (
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
|
#pragma once
#include <cstddef>
/// This template will be instanciated for each unique type, and the char variable will be ODR-used which gives it an unique address.
template <typename T>
struct TypeIdentifier {
static const char obj = 0;
};
template <typename T>
struct DefaultDeleter {
void operator()(T* ptr) const {
delete ptr;
}
};
template <typename>
struct RemoveMemberPtrImpl {};
template <typename T, typename U>
struct RemoveMemberPtrImpl<U T::*> {
using Type = U;
};
template <typename T>
using RemoveMemberPtr = typename RemoveMemberPtrImpl<T>::Type;
|