Boost Intrusive unordered_set is broken if you use the Fedora 17 vanilla installation that comes with GCC 4.7 and Boost 1.48 and use C ++ 11 mode. On Fedora 16, which comes with GCC 4.6.2 and Boost 1.47, it works. This violates the real code, and it even violates the example in the official documentation :
#include <boost/intrusive/unordered_set.hpp>
using namespace boost::intrusive;
struct MyClass : public unordered_set_base_hook<>
{};
typedef unordered_set<MyClass>::bucket_type bucket_type;
typedef unordered_set<MyClass>::bucket_traits bucket_traits2;
int main()
{
bucket_type buckets[100];
unordered_set<MyClass> uset(bucket_traits2(buckets, 100));
}
Error message:
/usr/include/boost/intrusive/hashtable.hpp:227:65: error: using the remote function constxpr boost :: intrusive :: detail :: bucket_traits_impl> :: type> :: bucket_traits_impl (const boost :: intrusive :: detail :: bucket_traits_impl> :: type> &)
, /usr/include/boost/intrusive/hashtable.hpp:30:0, /usr/include/boost/intrusive/unordered _set.hpp:18, t.cpp: 23:
/usr/include/boost/intrusive/detail/hashtable_node.hpp:80:8: note: 'constexpr boost:: intrusive:: detail:: bucket_traits_impl > :: type > :: bucket_traits_impl (const boost:: intrusive:: detail:: bucket_traits_impl > :: type > &) , 'boost:: intrusive:: detail:: bucket_traits_impl > :: type >
, , hashtable.hpp: 227:
template<class BucketTraits>
bucket_plus_size(BOOST_FWD_REF(BucketTraits) b_traits)
: bucket_traits_(::boost::forward<BucketTraits>(b_traits))
{}
Boost 1.47 :
bucket_plus_size(const bucket_traits &b_traits)
: bucket_traits_(b_traits)
{}
BOOST_FWD_REF(TYPE) TYPE &&, BOOST_NO_RVALUE_REFERENCES , const TYPE &. , !
, ? GCC, Boost, Fedora ?