【问题标题】:Boost.Intrusive and fast_pool_allocatorBoost.Intrusive 和 fast_pool_allocator
【发布时间】:2015-05-04 19:41:03
【问题描述】:

如果我这样说,我稍后会得到一个奇怪的编译器(gcc4.9,boost 1_58)错误:

当我去访问这个 IL 时:

for(auto & odp : odpList[i]) //<-error here
{

/usr/local/include/boost/intrusive/pack_options.hpp|33|error: no class template named ‘pack’ in ‘class boost::fast_pool_allocator<OneDepthPrice>’

typedef std::tuple<int, int> OneDepthPrice
typedef boost::intrusive::list<OneDepthPrice,  boost::fast_pool_allocator<OneDepthPrice>, constant_time_size<false>> BaseList;

正确的做法是什么?

【问题讨论】:

  • 请发布生成错误所需的最少代码量。并请发布您的整个错误。请让 cmets 详细说明所引用的行。如果您正在使用一个库,并且错误消息中提到了它的行格式,请包括该库的版本。可以一次编辑这些改进。
  • Yakk,有没有办法将 fast_pool_allocator 与侵入式列表一起使用?

标签: c++11 boost intrusive-containers


【解决方案1】:

这是因为分配器不是您可以传递的“选项”。

但是,尝试将分配器传递给侵入式容器是没有意义的,因为您将是管理容器外部分配的人。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-10
    • 2020-05-08
    • 1970-01-01
    • 1970-01-01
    • 2014-11-29
    • 2018-08-20
    相关资源
    最近更新 更多