Unimatrix_001
asked on
Specifying default allocator
Hello.
If I have something like vector<int>, there is a default allocator given, I know that uses new(), but say I'm creating a new container class, how can I specify to use the default allocator as the STL container classes do?
template<typename TAllocator=???>
Thanks,
Uni
If I have something like vector<int>, there is a default allocator given, I know that uses new(), but say I'm creating a new container class, how can I specify to use the default allocator as the STL container classes do?
template<typename TAllocator=???>
Thanks,
Uni
typedef vector<int, MyAllocator> MyVecType;
Sorry.. mis read... I'll try again...
struct MyAllocator // Must model an allocator concept
{
};
template < typename T, typename aT = MyAllocator>
struct MyVector
{
};
{
};
template < typename T, typename aT = MyAllocator>
struct MyVector
{
};
ASKER
But how about if I'm wanting the default allocator provided by the STL - i.e. vector<int> uses new(). How do I go about doing that?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ah thank you. :)