type_traits::is_null_pointer in C++ Last Updated : 28 May, 2020 Comments Improve Suggest changes Like Article Like Report The type_traits::is_null_pointer of C++ STL is used to check whether the given type is null_pointer or not. It returns the boolean value either true or false. Below is the syntax for the same: Header File: #include<type_traits> Syntax: template class T struct is_null_pointer; Parameter: The template type_traits::is_null_pointer accepts a single parameter T (Trait class) to check whether T is a null_pointer or not. Return Values: True: If the type is a null_pointer. False: If the pointer is not null pointer. Below programs illustrate the std::is_null_pointer template in C++ STL: Program 1: CPP14 // C++ program to illustrate // is_null_pointer template #include <bits/stdc++.h> #include <type_traits> using namespace std; // Driver Code int main() { cout << boolalpha; cout << "is_null_pointer:" << endl; cout << "int *&: " << is_null_pointer<decltype(nullptr)>::value << '\n'; cout << "int *[10]: " << is_null_pointer<int * [10]>::value << '\n'; cout << "float *: " << is_null_pointer<float*>::value << '\n'; cout << "int[10]:" << is_null_pointer<int[10]>::value << '\n'; return 0; } Output: is_null_pointer: int *&: true int *[10]: false float *: false int[10]:false Program 2: CPP14 // C++ program to illustrate // is_null_pointer template #include <bits/stdc++.h> #include <type_traits> using namespace std; // Driver Code int main() { cout << boolalpha << is_null_pointer<decltype(nullptr)>::value << endl << is_null_pointer<int*>::value << endl << is_pointer<decltype(nullptr)>::value << endl << is_pointer<int*>::value << endl; } Output: true false false true Reference: http://www.cplusplus.com/reference/type_traits/is_null_pointer/ Comment More infoAdvertise with us Next Article type_traits::is_null_pointer in C++ B bansal_rtk_ Follow Improve Article Tags : Misc C++ CPP-Functions Practice Tags : CPPMisc Similar Reads is_pointer Template in C++ The std::is_pointer template of C++ STL is used to check whether the given type is pointer or not. It returns a boolean value showing the same. Syntax: template <class T > struct is_pointer; Parameter: This template accepts a single parameter T (Trait class) to check whether T is a pointer or 2 min read NULL Pointer in C++ A NULL Pointer in C++ indicates the absence of a valid memory address in C++. It tells that the pointer is not pointing to any valid memory location In other words, it has the value "NULL" (or 'nullptr' since C++11). This is generally done at the time of variable declaration to check whether the poi 4 min read type_traits::alignment_of template in C++ It is used to find the member constant value equal to the alignment requirement of the type T. If T is a reference type than it returns the alignment requirements of the type referred to. If T is an array type than it returns the alignment requirements of the element type.Header File: #include<ty 1 min read RTTI (Run-Time Type Information) in C++ In C++, RTTI (Run-time type information) is a mechanism that exposes information about an object's data type at runtime and is available only for the classes which have at least one virtual function. It allows the type of an object to be determined during program execution. Runtime Casts The runtime 3 min read Smart Pointers in C++ In C++, pointers are the variables that stores the memory addresses. They are extensively used in dynamic memory location to store the address of allocated memory. But they bring a lot of issues.Problems with Normal PointersMemory Leaks: This occurs when memory is repeatedly allocated by a program b 4 min read Like