A C++ header-only associative container that maintains key-value pairs in first-in-first-out insertion order.
fifo_map is a C++ header-only associative container that stores key-value pairs while preserving their insertion order. It solves the problem of maintaining element sequence in associative containers where std::map orders by key values instead of insertion time. The container provides the same interface as std::map, making it easy to integrate into existing codebases.
C++ developers working with associative containers who need to maintain insertion order for serialization, caching, or ordered processing scenarios. Particularly useful for those implementing parsers, configuration systems, or ordered data pipelines.
Developers choose fifo_map when they need std::map compatibility with guaranteed insertion order preservation. Its header-only design and zero dependencies make it easy to integrate, while its performance characteristics match std::map for most operations with minimal overhead.
a FIFO-ordered associative container for C++
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Ensures elements are iterated in the exact order they were inserted, making it ideal for serialization or caching where sequence matters, as shown in the example code output.
Provides the same interface as std::map, allowing seamless replacement in existing codebases without API changes, as emphasized in the README.
Implemented in a single include file with no external dependencies beyond STL, simplifying integration and reducing build complexity.
Leverages std::unordered_map for O(1) average complexity on insert and erase, matching or exceeding std::map in common cases, as noted in the complexity section.
Relies on std::unordered_map internally, introducing O(n) worst-case complexity for insert and erase, which is less predictable than std::map's O(log n) guarantees.
Requires an additional unordered_map to track insertion order, increasing memory usage compared to a standard map, as mentioned in the space overhead description.
The README directs contributors to another project (ordered_map), indicating fifo_map may not receive significant future updates or enhancements, potentially leaving users with an outdated tool.