Skip to content

Ordered maps and sets

Compare
Choose a tag to compare
@JacksonAllan JacksonAllan released this 29 Jul 13:48
· 6 commits to main since this release

Version 1.3.0 introduces ordered maps and ordered sets (omap and oset). These containers are implemented as red-black trees and perform on par with their C++ STL equivalents (benchmarks compiled with GCC 12.1 via MinGW-w64):

This version also fixes next and prev for lists to correctly handle an r_end and end pointer-iterator argument, respectively.

It also deprecates reverse iteration for unordered maps and sets (map and set) because next does not correctly handle an r_end pointer-iterator argument and cannot be changed to do so without an impact on forward iteration performance. Hence, using maps and sets with the API macros last, prev, and r_end now generates a compiler warning (in GCC and Clang) or error (in MSVC), which can be disabled by defining CC_ALLOW_DEPRECATED before the macros are called. This functionality will be removed entirely in the next release. Note that the newly introduced ordered maps and sets do support reverse iteration.