John Zwinck
John Zwinck

Reputation: 249133

Boost Intrusive unordered_set static member function returns wrong size type

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

Upvotes: 2

Views: 97

Answers (1)

sehe
sehe

Reputation: 392921

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

Upvotes: 1

Related Questions