[libc-commits] [libc] [libc] Add is_null_pointer_v (PR #65627)

Guillaume Chatelet via libc-commits libc-commits at lists.llvm.org
Thu Sep 7 08:58:57 PDT 2023


https://github.com/gchatelet created https://github.com/llvm/llvm-project/pull/65627:

None

>From 3531f93b39609bd765304377aa0cbc25540066af Mon Sep 17 00:00:00 2001
From: Guillaume Chatelet <gchatelet at google.com>
Date: Thu, 7 Sep 2023 15:56:40 +0000
Subject: [PATCH] [libc] Add is_null_pointer_v

---
 libc/src/__support/CPP/type_traits/is_null_pointer.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libc/src/__support/CPP/type_traits/is_null_pointer.h b/libc/src/__support/CPP/type_traits/is_null_pointer.h
index e5c024b1b3898bc..718bd0940f6170d 100644
--- a/libc/src/__support/CPP/type_traits/is_null_pointer.h
+++ b/libc/src/__support/CPP/type_traits/is_null_pointer.h
@@ -18,6 +18,8 @@ namespace __llvm_libc::cpp {
 using nullptr_t = decltype(nullptr);
 template <class T>
 struct is_null_pointer : cpp::is_same<cpp::nullptr_t, cpp::remove_cv_t<T>> {};
+template <class T>
+LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
 
 } // namespace __llvm_libc::cpp
 



More information about the libc-commits mailing list