C++ 作为中断服务例程的静态模板成员函数
在下面的类映射器中,静态成员函数timer0CompA用作中断服务例程。它在中断向量中获得名称“\uuuvector\u14”C++ 作为中断服务例程的静态模板成员函数,c++,templates,interrupt,avr,C++,Templates,Interrupt,Avr,在下面的类映射器中,静态成员函数timer0CompA用作中断服务例程。它在中断向量中获得名称“\uuuvector\u14” struct Mapper { static void timer0CompA() __asm__("__vector_14") __attribute__((__signal__, __used__, __externally_visible__)); }; void Mapper::timer0CompA(){} 如果我尝试对模板类使用相同的方法 te
struct Mapper {
static void timer0CompA() __asm__("__vector_14") __attribute__((__signal__, __used__, __externally_visible__));
};
void Mapper::timer0CompA(){}
如果我尝试对模板类使用相同的方法
template<typename T>
struct Mapper {...};
模板
结构映射器{…};
模板成员函数不会插入到中断向量中
struct Mapper {
static void timer0CompA() __asm__("__vector_14") __attribute__((__signal__, __used__, __externally_visible__));
};
void Mapper::timer0CompA(){}
我知道,如果它能够工作,这将是有问题的:不同的实例化将在汇编代码中获得相同的名称,因此我们将获得一个双定义符号。但在我的情况下,这将是有用的
有什么提示吗?一个运行时解决方案,不完全是最优的: