簡體   English   中英

模板 function 中的模板 class

[英]Template function in template class

與此相關

無法編譯以下內容,我真的不明白為什么。

Codebolt 代碼

片段在這里

#include <vector>
#include <string>



template<typename T>
class A
{
    using func_type = bool(int const&);

    template<func_type U, func_type X>
    [[using gnu:cold]]void example(std::vector<std::string>&&);
};


template <typename T>
template <typename A<T>::func_type U, typename A<T>::func_type X>
void A<T>::example(std::vector<std::string>&&)
{

}

謝謝

如果您不想在func_type之外的任何地方使用 func_type。 然后你應該把它改成

using func_type = bool(*)(int const&);

請記住,語法類似於為 function 指針使用typedef

暫無
暫無

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

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