What is the bare minimum amount of code to create a custom container that would work with Qt foreach macro?
I have this so far
template< class T >
class MyList
{
public:
class iterator
{
public:
};
class const_iterator
{
public:
inline iterator& operator++ ()
{
return *this;
}
};
};
and I'm getting this compiler error:
4>.\main.cpp(42) : error C2100: illegal indirection
4>.\main.cpp(42) : error C2440: 'initializing' : cannot convert from 'MyList<T>::const_iterator' to 'int'
4> with
4> [
4> T=int
4> ]
4> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
when I try to compile this:
MyList<int> mylst;
foreach(int num, mylst )
qDebug() << num;