Originally Posted by
Daved
By the way, where is container initialized? I don't see it.
If I change the constructor to:
Code:
circular_iterator( std::list<T> * container, typename std::list<T>::iterator iter )
: container( container ), iter(iter) {};
It doesn't compile, complains that:
Code:
main.cpp: In function ‘int main()’:
main.cpp:69: error: conversion from ‘std::_List_iterator<int>’ to non-scalar type ‘circular_iterator<int>’ requested
main.cpp:76: error: no match for ‘operator=’ in ‘it = numbers.std::list<_Tp, _Alloc>::begin [with _Tp = int, _Alloc = std::allocator<int>]()’
main.cpp:5: note: candidates are: circular_iterator<int>& circular_iterator<int>::operator=(const circular_iterator<int>&)
which of course, I don't understand what this 'conversion to non-scalar type' is all about.