Boost Intrusive unordered_set static member function returns wrong size type

105 Views Asked by At

Consider this code, which compiles successfully:

#include <boost/intrusive/unordered_set.hpp>

using namespace boost::intrusive;

typedef unordered_set_member_hook<> Hook;

struct Item
{
    Hook hook;
};

typedef unordered_set<Item,
    member_hook<Item, Hook, &Item::hook>,
    size_type<uint32_t> > Map;

static_assert(4 == sizeof(typename Map::size_type));
static_assert(8 == sizeof(decltype(Map::suggested_upper_bucket_count(1000))));

In both the documentation and the code, suggested_upper_bucket_count() is declared this way:

static size_type suggested_upper_bucket_count(size_type);

So how can it be that Map::size_type is 4 bytes (uint32_t) yet the result of suggested_upper_bucket_count() is 8 bytes?

See it live: https://godbolt.org/g/3Sz8Xj

1

There are 1 best solutions below

2
On BEST ANSWER

It's a bug that's fixed in Boost 1.65