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 15 namespace LIBC_NAMESPACE::cpp { 16 17 // is_null_pointer 18 using nullptr_t = decltype(nullptr); 19 template <class T> 20 struct is_null_pointer : cpp::is_same<cpp::nullptr_t, cpp::remove_cv_t<T>> {}; 21 template <class T> 22 LIBC_INLINE_VAR constexpr bool is_null_pointer_v = is_null_pointer<T>::value; 23 24 } // namespace LIBC_NAMESPACE::cpp 25 26 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_TYPE_TRAITS_IS_NULL_POINTER_H 27