Reputation: 685
Please help to write c++ allocator for std::vector< nIcon*> class.
All examples i find shows just what methods i need to overwrite, not code examples.
I need to implement allocator using shared memory on windows (using CreateFileMapping and MapViewOfFile)
Upvotes: 0
Views: 1428
Reputation: 31445
You would use:
std::vector< nicon *, MyAllocator >
For how you would write MyAllocator
Upvotes: 0
Reputation: 31901
May I suggest you look at the boost interprocess library? It allows you to create allocators using shared memory.
I've seen some examples around, I would say just look a bit more. I agree that none of them do a perfect job, thus I won't recommend any in particular. Though beyond just implementing the small set of functions there is really nothing to it (provided you don't need to implement one for map).
Upvotes: 3