提高:: pool_allocator需要八个静态库? [英] boost::pool_allocator needs eight static libraries?

查看:353
本文介绍了提高:: pool_allocator需要八个静态库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Boost库,即从与pool_allocator类的帮助下池分配小型对象的内存添加到我的项目,而有限的功能,并发现我需要添加到项目dependendencies 4调试静态库文件和4发布静态库文件。即需要像这样的一行8库文件的依赖关系:

I tried to add to my project rather limited functionality from the Boost library, namely allocating memory for small objects from a pool with the help of the 'pool_allocator' class, and discovered that I need to add to the project dependendencies to 4 debug static library files and to 4 release static library files. I.e. 8 library file dependencies are needed for a single line like this:

boost::container::vector<int, boost::pool_allocator<int> > v;

有没有办法来使用这些类没有链接到静态库? (可能是模板参数的某种组合?)

Is there a way to using these classes without linking to the static libraries? (Maybe a certain combination of the template parameters?)

推荐答案

我所读到提升池:不使用它。该库是相当老(升压1.54所有文件都有版权2000年和2001年,除了pool_alloc.hpp,这是在2010年修改),你可以看的这里有关性能问题(去找詹姆斯甘孜的答案)。如果你只想使用升压,我会建议使用另一个库。如果你需要一个自定义分配器,执行基准。

All I read about boost pool is: don't use it at all. The library is rather old (in boost 1.54 all files have copyright 2000 and 2001 except pool_alloc.hpp, which was edited in 2010) You can look here for an question about performance (look for the answer of James Kanze). If you want only to use boost, I would suggest to use another library. If you need a custom allocator, do benchmarks.

编辑:

从<一个href=\"http://www.boost.org/doc/libs/1_54_0/libs/pool/doc/html/boost_pool/pool/introduction.html#boost_pool.pool.introduction.when_should_i_use_pool_\"相对=nofollow>池实况:

在一般情况下,当你需要一个更有效的方式做到不寻常的内存控制使用的池。

In general, use Pools when you need a more efficient way to do unusual memory control.

所以qustion是究竟什么是不寻常的存储控制?它是否满足您的特殊需要的内存?
安德烈Alexandrescu的写在现代C ++设计的关于内存分配,并有可能会因配置非常不同的要求释放模式。但根据该他不相信这是一个很好的篇章。

So the qustion is what exactly is unusual memory control? Does it meet your special need to memory? Andrei Alexandrescu has written in "Modern C++ Design" about memory allocation and that there may be very different requirements depending on allocation and deallocation patterns. But according to this paper he isn't convinced it was a very good chapter.

因此​​,对我的最后一个问题是羯羊池比的std ::更好的问题,内存管理分配?你必须messure它。即使在游泳池实现的痘痘逻辑有可能是在实现中使用的内存管理更高效的算法。顺便说一句池的错误之一就是升压池库权利,它不仅头文档

So for me the final question is wether pool is better than std::allocator for the problems memory management? You have to messure it. Even with litle logic implemented in pool there might be more efficient algorithms for memory management used in your implementation. By the way one of the bugs of pool is "Boost pool library it not header only as claimed in documentation".

这篇关于提高:: pool_allocator需要八个静态库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆