I have a class:
template<class T>
class MyClass
{
public:
class Iterator {
public:
Iterator(MyClass<T>&){/*some code*/};
};
operator Iterator();
Iterator& begin();
};
template<class T>
MyClass<T>::operator typename MyClass<T>::Iterator()
{
return MyClass::Iterator(*this);
}
template<class T>
typename MyClass<T>::Iterator& MyClass<T>::begin()
{
return *this;//<---------------cannot convert from MyClass to MyClass<T>::Iterator
}
Why am I getting an error? I've provided conversion operator so everything should be fine.