xref: /llvm-project/libc/src/__support/CPP/type_traits/is_null_pointer.h (revision 5ff3ff33ff930e4ec49da7910612d8a41eb068cb)
1 //===-- is_null_pointer type_traits -----------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H
9 #define LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H
10 
11 #include "src/__support/CPP/type_traits/is_same.h"
12 #include "src/__support/CPP/type_traits/remove_cv.h"
13 #include "src/__support/macros/attributes.h"
14 #include "src/__support/macros/config.h"
15 
16 namespace LIBC_NAMESPACE_DECL {
17 namespace cpp {
18 
19 // is_null_pointer
20 using nullptr_t = decltype(nullptr);
21 template <class T>
22 struct is_null_pointer : cpp::is_same<cpp::nullptr_t, cpp::remove_cv_t<T>> {};
23 template <class T>
24 LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
25 
26 } // namespace cpp
27 } // namespace LIBC_NAMESPACE_DECL
28 
29 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H
30