Which C++ type trait checks whether a specified type is a pointer type?
Options
- A. std::is_pointer
- B. std::is_reference
- C. std::is_const
- D. More than one of the above
- E. None of the above
Quiz Practice:
A. std::is_pointer
Answer: (A) std::is_pointer
std::is_pointer is a type trait used to determine whether a specified type is a pointer type.
For example, std::is_pointer<int*>::value returns true because int* is a pointer type.
For a normal type such as int, the result is false.
This can be useful in generic programming when the program needs to identify pointer types at compile time.