[intrusive] unordered_set::iterator_to

Hi,
I'm getting compile errors trying to use iterator_to() on an unordered_set
when given a const reference (and returning a const_iterator).
It works fine for me with ordered set.
I am able to reproduce this error by adding the following two lines:
MyClass const &cr = values[0];
base_set.iterator_to(cr);
to the bottom of the Example code (just before the return 0 from main) for
unordered_set at:
http://www.boost.org/doc/libs/1_45_0/doc/html/intrusive/unordered_set_unorde...
The error is:
/opt/boost/include/boost-1_38/boost/intrusive/hashtable.hpp: In member
function
‘boost::intrusive::detail::hashtable_iterator ::type::const_pointer>::reference) const [with Config =
boost::intrusive::detail::usetopt /opt/boost/include/boost-1_38/boost/intrusive/unordered_set.hpp:733:
instantiated from ‘typename
boost::intrusive::hashtable_impl<Config>::const_iterator
boost::intrusive::unordered_set_impl<Config>::iterator_to(typename
boost::intrusive::hashtable_impl<Config>::const_reference) const [with
Config =
boost::intrusive::detail::usetopt ::type>, 3ul>]’ ::type>, 3ul> >, example.cpp:82: instantiated from here
/opt/boost/include/boost-1_38/boost/intrusive/hashtable.hpp:1682: error: no
matching function for call to
‘boost::intrusive::detail::hashtable_iterator ::type>, 3ul> >* const)’ I am using 1_38_0. I have not yet tried 1_45_0, but I have gone through the
entire list of fixed bugs on the release notes between 1_38 and 1_45.
I'll try 1_45_0 in the next few days, just in case.
I am able to work around my issue by casting away const on my reference
before calling iterator_to and assigning the result back into a
const_iterator, so for me it is nothing more than an annoyance, but I
thought I'd bring it to your attention so it can be fixed in a future
release.
Thanks,
Paul Rose

Hi,
I just confirmed that I get the same compile error with 1_45_0 using gcc
4.2.1 (Macintosh XCode 3.2.2).
Original error was with gcc 4.3.x on SuSE linux 11
Thanks,
Paul Rose
On Thu, Feb 10, 2011 at 12:58 PM, Paul Rose
Hi,
I'm getting compile errors trying to use iterator_to() on an unordered_set when given a const reference (and returning a const_iterator).
It works fine for me with ordered set.
I am able to reproduce this error by adding the following two lines:
MyClass const &cr = values[0]; base_set.iterator_to(cr);
to the bottom of the Example code (just before the return 0 from main) for unordered_set

Sorry to keep replying to myself.
To fix this I chaged:
return
const_iterator(bucket_type::s_iterator_to(priv_value_to_node(const_cast<reference>(value))),
this);
to:
return const_iterator(bucket_type::s_iterator_to(const_cast

Thanks Ion,
After my last post, but before getting your reply, I figured out that I
could post to the bug tracker.
To save you from creating a dup entry, please refer to
https://svn.boost.org/trac/boost/ticket/5191
BTW: I'm really enjoying using intrusive -- thanks for your efforts.
Thanks again,
Paul Rose
2011/2/14 Ion Gaztañaga
El 14/02/2011 20:48, Paul Rose escribió:
Sorry to keep replying to myself.
To fix this I changed:
Thanks for the report and the fix. I'll add it to trunk ASAP.
Best,
Ion
participants (2)
-
Ion Gaztañaga
-
Paul Rose