std::is_null_pointer(3)
π NAME π
hey bestie!! welcome to std::is_null_pointer(3) from the C++ Standard Libary π (yes, that's the manual name, and yes we're obsessed). this page is literally about std::is_null_pointer, no cap.
std::is_null_pointerβstd::is_null_pointer
β¨ Synopsis β¨
Defined in header <type_traits>
template< class T > (since C++14)
struct is_null_pointer;
std::is_null_pointer is a UnaryTypeTrait.
Checks whether T is the type std::nullptr_t.
Provides the member constant value that is equal to true, if T is the type std::nullptr_t, const std::nullptr_t, volatile std::nullptr_t, or const volatile std::nullptr_t.
Otherwise, value is equal to false.
π¨ bestie warning: if the program adds specializations forstd::is_null_pointerorstd::is_null_pointer_v(since C++17), the behavior is undefined. do not do that, fr fr.
πΈ Template parameters πΈ
Tβ a type to check
π§ Helper variable template π§
this helper variable template is since C++17, iykyk:
template< class T >
inline constexpr bool is_null_pointer_v = is_null_pointer<T>::value;
π« Inherited from std::integral_constant π«
inherited from std::integral_constant β that's the whole vibe.
π Member constants π
value[static]βtrueifTis the typestd::nullptr_t(possibly cv-qualified),falseotherwise (public static member constant)
π¦ Member functions π¦
operator boolβ converts the object tobool, returnsvalue(public member function)operator()β returnsvalue(C++14) (public member function)
π Member types π
value_typeβbooltypeβstd::integral_constant<bool, value>
π₯ Possible implementation π₯
template<class T>
struct is_null_pointer : std::is_same<std::nullptr_t,
std::remove_cv_t<T>> {};
π Notes π
std::is_pointer is false for std::nullptr_t because it is not a built-in pointer type.
Feature-test macro tea β:
- Feature-test macro β
__cpp_lib_is_null_pointer - Value β
201309L - Std β
(C++14) - Feature β
std::is_null_pointer
π Example π
// Run this code
#include <type_traits>
static_assert(std::is_null_pointer_v<decltype(nullptr)>);
static_assert(!std::is_null_pointer_v<int*>);
static_assert(!std::is_pointer_v<decltype(nullptr)>);
static_assert(std::is_pointer_v<int*>);
int main()
{
}
π See also π
is_void(C++11)β checks if a type isvoid(class template)is_array(C++11)β checks if a type is an array type (class template)is_pointer(C++11)β checks if a type is a pointer type (class template)is_enum(C++11)β checks if a type is an enumeration type (class template)is_union(C++11)β checks if a type is a union type (class template)is_class(C++11)β checks if a type is a non-union class type (class template)is_function(C++11)β checks if a type is a function type (class template)is_object(C++11)β checks if a type is an object type (class template)
kisses bestie π β source: http://cppreference.com, version/date: 2024.06.10, page: std::is_null_pointer(3). bye! π«Ά
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms