boost pool_allocator 报错 'rebind'

来源:互联网 发布:mysql数据库价格 编辑:程序博客网 时间:2024/06/04 17:41
#include "stdafx.h"#include <vector>#include <boost/pool/pool.hpp>int _tmain(int argc, _TCHAR* argv[]){std::vector<int, boost::pool_allocator<int>> v;return 0;}

编译报错:

d:\program files\microsoft visual studio 10.0\vc\include\vector(421): error C2903: 'rebind' : symbol is neither a class template nor a function template

怀疑是pool_allocator与Vc的STL不兼容。

后来发现是应该使用pool_alloc.hpp头文件才行:

#include <boost/pool/pool_alloc.hpp>

Boost文档仅假定

// Include all of Pool files#include <boost/pool.hpp>

实际上,boost/pool.hpp 不存在。

感叹模板类的编译错误信息太没头绪。

后来发现其中有一行错误:

d:\program files\microsoft visual studio 10.0\vc\include\vector(421): error C2027: use of undefined type 'boost::pool_allocator<T>'

为了这一行错误,总的出错报告接近400行。


原创粉丝点击