簡體   English   中英

header 中的“void f(auto) {}”是否需要“inline”?

[英]Is “inline” required for “void f(auto) {}” in a header?

考慮

template<typename T>
inline void f(T) {} // "inline" can be safely removed.

inline void f(auto) {} // Can "inline" also be safely removed?

根據 C++ 標准,在后一種情況下可以安全地刪除inline嗎?

來自[dcl.fct]/18

縮寫的 function 模板是具有一個或多個通用參數類型占位符 ([dcl.spec.auto]) 的 function 聲明。 An abbreviated function template is equivalent to a function template ([temp.fct]) whose template-parameter-list includes one invented type template-parameter for each generic parameter type placeholder of the function declaration, in order of appearance.

重點補充。 這不會為inline不是默認設置留下很大的回旋余地。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM