std::is_null_pointer
Min standard notice:
Header: <type_traits>
std::is_null_pointer is a UnaryTypeTrait.
# Declarations
template< class T >
struct is_null_pointer;
(since C++11)
# Notes
std::is_pointer is false for std::nullptr_t because it is not a built-in pointer type.
In libc++, std::is_null_pointer is not available in C++11 mode.
# Example
#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()
{
}
# Defect reports
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 2247 | C++11 | the type trait for detecting std::nullptr_t was missing | added |