Click here to Skip to main content
15,886,518 members
Articles / General Programming / Algorithms

Segmented Map, a Compromise Between Flat Map and std::map

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
18 Sep 2022CPOL5 min read 5.5K   62   4  
This article proposes a mapping algorithm, called Segmented Map, which is almost as fast as Flat Map is random access and enumeration of elements and close to std::map in insertion of elements.
This article provides an implementation of a container, called segmented map, which is almost as fast as flat map in random access and enumeration of elements and close to std::map in insertion of elements. The source code is written in C++17 and can be compiled in any C++17 compiler. Benchmarks with the "int-double" and "string-string" key-value pairs are provided for Microsoft VC++ 2022 and GCC 11.2 C++.

Views

Daily Counts

Downloads

Weekly Counts

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions