Boost Intrusive unordered_set静态成员函数返回错误的大小类型

时间:2017-09-08 06:47:26

标签: c++ boost boost-intrusive

考虑一下这个成功编译的代码:

#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))));

the documentationthe code中,suggested_upper_bucket_count()以这种方式声明:

static size_type suggested_upper_bucket_count(size_type);

那么Map::size_type是4个字节(uint32_t)又怎么可能suggested_upper_bucket_count()的结果是8个字节呢?

现场直播:https://godbolt.org/g/3Sz8Xj

1 个答案:

答案 0 :(得分:1)

这是在Boost 1.65

中修复的错误