summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/NeKit/Nullable.h
blob: 30ce9da40e7ff4f921ec410ee9393fcb95c87ee5 (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
32
/* ========================================

  Copyright (C) 2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.

======================================== */

#ifndef __NE_KIT_NULLABLE_H__
#define __NE_KIT_NULLABLE_H__

#include <NeKit/Config.h>

namespace Kernel {
template <class Type>
struct IsDefined final {
  using ResultType    = Type;
  using ResultTypeRef = Type&;

  static constexpr bool kValue = true;
};

template <>
struct IsDefined<nullPtr> final {
  static constexpr bool kValue = false;
};

template <class Type>
concept IsAcceptable = requires() {
  { IsDefined<Type>::kValue };
};
}  // namespace Kernel

#endif  // !__NE_KIT_NULLABLE_H__