- 论坛徽章:
- 0
|
邮件列表中又报告了一个移植的问题。当然还是因为我写得不规范造成的。不过我想了解下:
- template<typename _uintX>
- const class contact<_uintX>::uint_type contact<_uintX>::get_node_id()
- const
- {
- return m_node_id;
- }
复制代码
和
- template<typename _uintX>
- const typename contact<_uintX>::uint_type
- contact<_uintX>::get_node_id() const
- {
- return m_node_id;
- }
复制代码
中的,使用class和typename生命的contact中的类型。这里用class还是typename有何不同?是否在模板中typedef时使用的哪个关键字,这里就要用哪个?我在模板中定义的时候使用的是typename.
原文:
Hey,
I was just wondering if anyone could tell me if there a big difference
between:
template<typename _uintX>
const class contact<_uintX>::uint_type contact<_uintX>::get_node_id()
const
{
return m_node_id;
}
And
template<typename _uintX>
const typename contact<_uintX>::uint_type
contact<_uintX>::get_node_id() const
{
return m_node_id;
}
It doesn't compile under vc71 with the class declaration |
|