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_unordered_multiset.html#intrusive.unordered_set_unordered_multiset.unordered_set_unordered_multiset_example

The error is:
/opt/boost/include/boost-1_38/boost/intrusive/hashtable.hpp: In member function ‘boost::intrusive::detail::hashtable_iterator<boost::intrusive::hashtable_impl<Config>, true> boost::intrusive::hashtable_impl<Config>::iterator_to(typename std::iterator_traits<typename boost::intrusive::detail::eval_if_c<boost::intrusive::hashtable_impl<Config>::external_value_traits, boost::intrusive::detail::eval_value_traits<typename Config::value_traits>, boost::intrusive::detail::identity<typename Config::value_traits> >::type::const_pointer>::reference) const [with Config = boost::intrusive::detail::usetopt<boost::intrusive::detail::base_hook_traits<MyClass, boost::intrusive::slist_node_traits<void*>, safe_link, boost::intrusive::default_tag, 4>, boost::hash<MyClass>, std::equal_to<MyClass>, long unsigned int, boost::intrusive::detail::bucket_traits_impl<boost::intrusive::detail::get_slist_impl<boost::intrusive::slist_node_traits<void*> >::type>, 3ul>]’:

/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<boost::intrusive::detail::base_hook_traits<MyClass, boost::intrusive::slist_node_traits<void*>, safe_link, boost::intrusive::default_tag, 4>, boost::hash<MyClass>, std::equal_to<MyClass>, long unsigned int, boost::intrusive::detail::bucket_traits_impl<boost::intrusive::detail::get_slist_impl<boost::intrusive::slist_node_traits<void*> >::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<boost::intrusive::hashtable_impl<boost::intrusive::detail::usetopt<boost::intrusive::detail::base_hook_traits<MyClass, boost::intrusive::slist_node_traits<void*>, safe_link, boost::intrusive::default_tag, 4>, boost::hash<MyClass>, std::equal_to<MyClass>, long unsigned int, boost::intrusive::detail::bucket_traits_impl<boost::intrusive::detail::get_slist_impl<boost::intrusive::slist_node_traits<void*> >::type>, 3ul> >, true>::hashtable_iterator(boost::intrusive::slist_iterator<boost::intrusive::slist_impl<boost::intrusive::slistopt<boost::intrusive::trivial_value_traits<boost::intrusive::slist_node_traits<void*>, normal_link>, long unsigned int, false, false, false> >, true>, const boost::intrusive::hashtable_impl<boost::intrusive::detail::usetopt<boost::intrusive::detail::base_hook_traits<MyClass, boost::intrusive::slist_node_traits<void*>, safe_link, boost::intrusive::default_tag, 4>, boost::hash<MyClass>, std::equal_to<MyClass>, long unsigned int, boost::intrusive::detail::bucket_traits_impl<boost::intrusive::detail::get_slist_impl<boost::intrusive::slist_node_traits<void*> >::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