N
naveen
All,
I want to use a map whose key is an int and value is a big structure
(500 bytes). Which one is better approch
1. passing value as it is map<key,struct>
2. passing value by address map<key,struct*)
I was thinking in first case, since whole structure is passed when new
stack frames are created (ELF format) for STL functions, whole
structure will be passed to the stack (this is infact true for any
function)
Moreover in first case all memory allocation will be done by STL
allocator (assume default allocator), in second case I can allocate
memory from my memory manager ( I do no have custom STL allocator)
Please let me know the pros and cons of both the approaches.
thanks
Naveen
I want to use a map whose key is an int and value is a big structure
(500 bytes). Which one is better approch
1. passing value as it is map<key,struct>
2. passing value by address map<key,struct*)
I was thinking in first case, since whole structure is passed when new
stack frames are created (ELF format) for STL functions, whole
structure will be passed to the stack (this is infact true for any
function)
Moreover in first case all memory allocation will be done by STL
allocator (assume default allocator), in second case I can allocate
memory from my memory manager ( I do no have custom STL allocator)
Please let me know the pros and cons of both the approaches.
thanks
Naveen