پاسخ داده شده: تفاوت کلاس های map,multimap
سلام؛ برای وقتی که بخوایم یک سری دادهای بر اساس کلیدهایی رو داشته باشید، مثلاً یک ساختاری مثل Json. در std::map شما نمیتونید که کلید تکراری داشته باشید ولی در std::mulimap این اجازه به شما داده میشه.
به نقل از cppreferences:
Multimap is an associative container that contains a sorted list of key-value pairs, while permitting multiple entries with the same key. Sorting is done according to the comparison function
Compare
, applied to the keys. Search, insertion, and removal operations have logarithmic complexity.