In function call, why doesn't nullptr match a pointer to a template object?

后端 未结 5 1924
萌比男神i
萌比男神i 2021-02-20 11:29

Here is an example of a code that works perfectly:


#include
#include

template< class D, template< class D, class A >         


        
5条回答
  •  南旧
    南旧 (楼主)
    2021-02-20 12:24

    Compiler can not deduce the second argument type because std::nullptr_t is not a pointer type.

    1 The pointer literal is the keyword nullptr. It is a prvalue of type std::nullptr_t. [Note: std::nullptr_t is a distinct type that is neither a pointer type nor a pointer to member type; rather, a prvalue of this type is a null pointer constant and can be converted to a null pointer value or null member pointer value. [§2.14.7]

提交回复
热议问题