Sergey
Sergey

Reputation: 685

need to write shared memory allocator for c++ std::vector

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

Answers (2)

CashCow
CashCow

Reputation: 31445

You would use:

std::vector< nicon *, MyAllocator >

For how you would write MyAllocator

Upvotes: 0

edA-qa mort-ora-y
edA-qa mort-ora-y

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

Related Questions