繁体   English   中英

如何在模板 class 中使用 scope 分辨率运算符用于嵌套的 class?

[英]How do I use the scope resolution operator for a nested class inside a template class?

template <typename T>
    class School{
     public:
    class Student{
     public:
     Student & operator++();
     Student operator++(int);
               
}
}

假设我的 header 文件中有这个,我将如何使用 scope 分辨率运算符来处理 hpp 文件? 我已经尝试过了,但结果是 & 标记之前的预期初始化程序

template <class T>
T School<T> :: Student& Student:: operator++()
{

}

还有一个,为了胜利(来自typename的捏击):

template <class T>
typename School<T>::Student &School<T>::Student::operator++()
{
    return *this;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM