使用字符串做为无类型模板参数时要注意以下几点:

1、 template<class Item_type, const char xml_root_name[]>,中不要使用const char* 等类型。

2、在将模板类实例化时,定义的参数要使用extern 声明。extern const char hostport_root_name[];

3、如果该类是写在“.h”文件里的,不要直接extern const char hostport_root_name[] = “hostport”;,而是在头文件里只声明,在CPP中写上实现,const char hostport_root_name[] =  “hostport”;

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2022-01-15
  • 2021-06-09
  • 2022-02-09
  • 2022-02-11
  • 2021-08-08
猜你喜欢
  • 2022-01-29
  • 2022-01-13
  • 2022-02-12
  • 2022-01-26
  • 2022-12-23
  • 2022-01-14
  • 2021-11-18
相关资源
相似解决方案