Specified template type output from nullptr?

Given the function:

template <class T> void f(const T* const ptr);

What is Tfor f(nullptr)?

+5
source share
1 answer

I would have to answer this because they are not. From paragraph 2.14.7 / 1 (main focus):

The pointer literal is the nullptr keyword. This is a prvalue of type std :: nullptr_t. [Note: std :: nullptr_t is a separate type, which is neither a pointer type nor a pointer to a member type; rather, a prvalue of this type is a null pointer constant and can be converted to a null pointer value or a null element pointer value.

T * std::nullptr_t, std::nullptr_t - not , . nullptr GCC 4.7.2 , , f(std::nullptr_t), f(const T *), , a std::nullptr_t T *.

+5

All Articles