Can't get the following to compile and I don't really understand why.
Snippet here
#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>&&)
{
}
Thank you
If you don't want to use the func_type
anywhere outside of your class. Then you should change it to
using func_type = bool(*)(int const&);
Remember that the syntax is similar to emplying typedef
for function pointers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.