gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:08:18 24 4
gpt4 key购买 nike

考虑这段编译成功的代码:

#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

最佳答案

这是一个在 Boost 1.65 中修复的错误

关于c++ - Boost Intrusive unordered_set 静态成员函数返回错误的大小类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46110249/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com