Dear C++ experts
I applogize for my frequent similar submissions,
but I am really in trouble.
I am bothered by high overhead of destruction of STL container like,
std::unodered_map<int, std::vector<std::pair<int, int> > >
,
or
std::unodered_map<int, std::unodered_map<int, std::vector<std::pair<int, int> > > >
,
particularly due to destruction of the last element,
std::vector<std::pair<int, int> >
.
(Indeed, not std but TBB's concurrent containers)
I heard that destruction of std::vector<Object> entails high cost.
However if the Object type is primitive(such as char*, int etc),
its destruction seems to become fast as the below.
<
https://stackoverflow.com/questions/22709344/does-stdvectortclear-call-destructor-of-the-content>
In my case, my Object type is std::pair<int, int>, so that I could split them into individual containers (two std::vector<int> ).
But, the size of type std::pair<int, int> is previously known,
therefore, I suppose if there is a smart way to fastly destruct std::vector<std::pair<int, int>.
Finally, could I ask you the below questions
(1) could vector of primitive type be fastly destructed compared to Object type? (such as std::vector<int>)
(2) Is there a way to destruct fixed-size object (like std::pair<int,int>) in a similar manner to the above (1) case?
I would appreciate it if you could help me.
Kind regards