J
Joshua Kolden
STL allocators are templates so that when you write one you are obliged
to make it work with any type. However, the Intel IPP library that we
use has memory aligned allocators for each of 15 different types. For
example an 8 bit unsigned array is allocated with ippsMalloc_8u(size).
So I want to create memory aligned allocators for use with the STL (in
particular the vector container) that is fast (due to alignment), and
pointer compatible with other IPP library functions.
Is there any way to create an allocator of a fixed type? Right now it
seems the only way it can work is:
vector<Ipp8u, myAllocIpp8u<Ipp8u>> ipp8uVector;
But A) its redundant and liable to lead to allocator mismatch, and B)
leaves the internal rebind typecast undefined.
I'd prefer either:
vector<Ipp8u, myAllocIpp8u> ipp8uVector; // fixed type allocator
or
vector<Ipp8u, myAlloc<Ipp8u>> ipp8uVector; // allocator that can
// switch by type
But I don't see how either of these are possible.
Thanks,
j
to make it work with any type. However, the Intel IPP library that we
use has memory aligned allocators for each of 15 different types. For
example an 8 bit unsigned array is allocated with ippsMalloc_8u(size).
So I want to create memory aligned allocators for use with the STL (in
particular the vector container) that is fast (due to alignment), and
pointer compatible with other IPP library functions.
Is there any way to create an allocator of a fixed type? Right now it
seems the only way it can work is:
vector<Ipp8u, myAllocIpp8u<Ipp8u>> ipp8uVector;
But A) its redundant and liable to lead to allocator mismatch, and B)
leaves the internal rebind typecast undefined.
I'd prefer either:
vector<Ipp8u, myAllocIpp8u> ipp8uVector; // fixed type allocator
or
vector<Ipp8u, myAlloc<Ipp8u>> ipp8uVector; // allocator that can
// switch by type
But I don't see how either of these are possible.
Thanks,
j