@kis2009dsh 
Good suggestion.
But the iterator of std::map is different from std::vector. How to implement this function?
Could you paste some codes for that? Thanks.