i have segfault in regardless of what i do: m_votes.insert(std::make_pair(inOrderId, Vote(inOrderId, inPermittedDrivers, inSeconds)));
i've tried to use std::map::find(...) first, but i have same result. backtrace:
i suppose the reason of segfault is argument __y=@0x758948f87d894905. i have no idea why this is! at that moment m_votes map is empty. please, suggest me...
When I use C++ STL libraries, I always make it a point to supply the datatype in the templates. make_pair is templatized function so for me I put in the datatypes. Don't know if this is the reason for your error though.
I don't know why you have a crash, but consider these points.
1. You don't need to define/implement a copy constructor, the default is sufficient.
2. Vote doesn't need a virtual destructor (as it stands), and again, the default is sufficient.
3. VoteContainer has a map of Vodes, so it must copy Vote entries in.
4. registerVote passes a vector by value, and a Vote constructor takes a vector by value.
5. Have you thought about the number of vector copies involved in calling registerVote?
i've found out there is problem not in my code! i've replaced std::map to other structures but the result was same! i've deleted stl from that code and segfault was in Vote constructor, i've deleted this class and segfault was in other stl structures of my code! what is that? help me please.