summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/NeKit/Domain.h
blob: 268487369410384ba9fd48ea051e8c9506c0789a (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
33
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Licensed under the Apache License, Version 2.0 (see LICENSE file)
// Official repository: https://github.com/ne-foss-org/nekernel

#ifndef __NE_KIT_DOMAIN_H__
#define __NE_KIT_DOMAIN_H__

#include <NeKit/Config.h>

namespace Kernel {
template <class Type>
struct IsDefined final {
  using ResultType    = Type;
  using ResultTypeRef = Type&;
  using TypeRef       = ResultTypeRef;
  using ConstType     = const Type&;
  using TypePtr       = Type*;

  static constexpr bool kValue = true;
};

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

using NullDomain = IsDefined<nullPtr>;

template <class Type>
using Domain = IsDefined<Type>;
}  // namespace Kernel

#endif  // !__NE_KIT_DOMAIN_H__