I get an error in my template class. Here's a portion of code from my program:
1 2 3 4 5 6 7 8
template<typename Key, typename ItemT>
class Pool
{
public:
typedeftypename std::pair<Key, PoolItem<ItemT> > PairType;
typedef std::allocator<PairType, managed_shared_memory::segment_manager> ShmemAllocator;// Compile error!!!
};
It gives error in the allocator type definition. Here's the error: include/pool.hpp:117: error: wrong number of template arguments (2, should be 1)
/usr/lib/gcc/i686-redhat-linux/4.4.2/../../../../include/c++/4.4.2/bits/stringfwd.h:45: error: provided for ‘template<class _Alloc> class std::allocator’
In Boost documentation, there's a sample like that which is compiled without any problem:
Maybe the boost library defines such an allocator (one that takes two params) - i say this because the boost code you posted does not have std:: namespace in front of allocator - whereas it says std::pair
In which case, that particular boost allocator must be in a boost_namespace somewhere.
But your compiler is correct - std::allocator does not take two type parameters