7. (Pointers and Non-pointers) This exercise consists of calling some functions from the Primary type category. Answer
Question:
7. (Pointers and Non-pointers)
This exercise consists of calling some functions from the Primary type category.
Answer the following questions:
a) Write a function to determine if a type is a pointer, null pointer, lvalue reference or rvalue reference.
b) Determine if a type is a member function pointer or if it is a pointer to a non-static member object.
c) Is a shared pointer a pointer type? Is it a pointer type when converted to a raw pointer?
Typical code is:
template
void IsPointer(const T& t)
{ // First example of type_traits;check if t is a pointer
// Return type is std::true_type or std::false_type if (std::is_pointer
{
std::cout << "This is a pointer type argument";
}
else {
std::cout << "_not_ a pointer type argument";
}
}
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Question Posted: