![](/img/trans.png)
[英]What is a proper use-case of `std::nullptr_t` template parameters?
[英]Is there any use for std::nullptr_t except to disambiguate nullptr parameters?
除了幫助避免 function 使用nullptr
調用之外, std::nullptr_t
類型真的有任何用處嗎?
void f(int* pi) {}
void f(std::nullptr_t np) {}
如果沒有f(std::nullptr_t)
, f(nullptr)
將調用f(int*)
。
謝謝
不,那是它唯一的用例。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.