Boost logo

Boost Users :

From: Martin Wartens (martin.wartens_at_[hidden])
Date: 2005-04-22 11:27:49


Hi,
I have got some problems with the unordered containers from the sandbox files.
The problem is that iterator_base<T> can't be converted into iterator or
const_iterator. I helped myself by adding
"friend class const_iterator; friend class iterator;"
to iterator_base and adding a constructor like "const_iterator
(iterator_base_type i)" to const_iterator/iterator. I have no clue if this is
could be an official solution. See sample code below to expose the problem.
Bye, Martin

typedef boost::unordered_set<int> MySet;
{
MySet myset;
MySet::const_iterator citer = myset.begin();
MySet::iterator iter = myset.begin();
MySet::const_iterator citer2= ++citer; //doesn't work, but should (?)
MySet::iterator iter2 = ++citer; //doesn't work, and should not work (?)
MySet::iterator iter3 = ++iter; //doesn't work, but should (?)
MySet::const_iterator citer3 = iter; //works, you can't do that
                                     //with std::containers (?)
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net