![](/img/trans.png)
[英]What does the 'void()' in 'auto f(params) -> decltype(…, void())' do?
[英]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.