Set vs Map containers in C++

This article is to discuss the difference between a set and a map which are both containers in the Standard Template Library in C++.

TLDR

The map container stores unique key-value pairs in a sorted order, while a set container, which is like a specialized version of the map stores unique keys only, where the key is identical to the value it maps to.

Set containerA set is a sorted associated container of unique elementsEach element can occur only once, so duplicates are not allowed in setsEle...
 •  0 comments  •  flag
Share on Twitter
Published on May 20, 2021 07:41
No comments have been added yet.