2014-02-25 37 views
0

我試圖用boost::fast_pool_allocator代替標準分配器,它不會工作(具有諷刺意味的是與另一個boost庫),因爲fast_pool_allocator甚至有多個模板參數儘管它聲稱與std::allocator兼容,除第一個以外的所有內容都有默認值。使用boost :: fast_pool_allocator代替std :: allocator

我想通過它作爲一個類模板,期望單個模板參數。具體的錯誤:

error: type/value mismatch at argument 3 in template parameter list for "template<class Point, template<class, class> class Container, template<class> class Allocator> class boost::geometry::model::multi_point" 

error: expected a template of type "template<class> class Allocator", got "template<class T, class UserAllocator, class Mutex, unsigned int NextSize, unsigned int MaxSize> class boost::fast_pool_allocator" 

有沒有辦法讓這個實際工作?

+0

聽起來像Boost.Geometry已損壞。我會提交一個錯誤。 –

回答

4

使用下面的模板,而不是boost::fast_pool_allocator

template <class T> 
using fast_pool_allocator_t = boost::fast_pool_allocator<T>; 

此,如果你不使用C++ 11也可以工作。

template <class T> 
struct fast_pool_allocator_t : boost::fast_pool_allocator<T> 
{ }; 
相關問題