c++基础笔记20-type2type

转载自 link

type2type

这种技术类似与int2type,他用来解决函数不能偏特化的问题,当然现在的编译器似乎已经支持这个功能了。

template <class T>
struct type2type {
  typedef T orignal_type;
};

有了这个代码,我们能模拟出偏特化,甚至函数返回值的重载,而且这个类型不占任何空间。

猜你喜欢

转载自blog.csdn.net/qq_41157212/article/details/114812346
今日推荐