本文介紹了“模板"與“模板"沒有括號 - 有什么區別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
假設我已經聲明:
現在,
和
語義上?不帶括號的模板和帶空括號的模板在其他上下文中是否有其他語義?
semantically? And do template-with-no-brackets and template-with-empty-brackets have other semantics in other contexts?
相關:如何強制實例化 C++ 模板的特定實例?
推薦答案
template <>void foo<int>(int& t);
聲明模板的特殊化,可能具有不同的主體.
template <> void foo<int>(int& t);
declares a specialization of the template, with potentially different body.
template void foo
導致模板的顯式實例化,但不引入特化.它只是強制為特定類型實例化模板.
template void foo<int>(int& t);
causes an explicit instantiation of the template, but doesn't introduce a specialization. It just forces the instantiation of the template for a specific type.
這篇關于“模板"與“模板"沒有括號 - 有什么區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!