什么编译器支持成员函数模板偏特化

chen3feng 2002-01-26 07:15:29
发信人: RoachCock (穷鬼), 信区: Programming
标 题: 什么编译器支持成员函数模板偏特化
发信站: BBS 水木清华站 (Fri Jan 25 22:04:12 2002)

以下这段代码,VC6,BCB5都不能编译通过

template<class T>
struct member_function_traits
{
};
template<class RT, class OT>
struct member_function_traits< RT (OT::*)() >
{
typedef OT object_type;
typedef RT result_type;
};
template<class RT, class OT, class AT>
struct member_function_traits< RT (OT::*)(AT) ) >
{
typedef OT object_type;
typedef RT result_type;
typedef AT argument_type;

typedef AT first_argument_type;
};
template<class RT,class OT,class AT1,class AT2>
struct member_function_traits< RT (OT::*)(AT1,AT2) >
{
typedef OT object_type;
typedef RT result_type;
typedef AT1 first_argument_type;
typedef AT2 second_argument_type;
};

--
要钱没有,要命也没有

...全文
143 3 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
chen3feng 2002-01-28
  • 打赏
  • 举报
回复
经人证实
gcc 2.95 gcc3.0 intel C++ 5支持,
BCB5支持一般的偏特化,但是成员函数指针的偏特化编译不了
lak47 2002-01-26
  • 打赏
  • 举报
回复
偏特化VC6.0是不支持的
gcc试一试
chen3feng 2002-01-26
  • 打赏
  • 举报
回复
好像“我的参与“里只有回的,没有问的,怕以后不好找,mark一下

15,447

社区成员

发帖
与我相关
我的任务
社区描述
C/C++ 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧