C++ std::map quirks emulated in rust
  • Rust 99.5%
  • Shell 0.5%
eadf 1912fd1181
All checks were successful
ci/woodpecker/push/test/2 Pipeline was successful
ci/woodpecker/push/test/1 Pipeline was successful
MSRV 1.87.0
bumped deps
refactoring
2025-12-01 23:12:09 +01:00
.cargo refactoring 2025-05-15 22:44:57 +02:00
.github/workflows Added a linked list container type backed by a BTreeMap for O(log n) random access and O(1) for indexed, step by step, access. 2025-04-28 19:44:10 +02:00
.woodpecker refactoring 2025-05-09 17:22:56 +02:00
examples refactoring 2025-05-15 22:44:57 +02:00
src MSRV 1.87.0 2025-12-01 23:12:09 +01:00
tests MSRV 1.87.0 2025-12-01 23:12:09 +01:00
.gitignore refactoring 2025-05-15 22:44:57 +02:00
Cargo.toml MSRV 1.87.0 2025-12-01 23:12:09 +01:00
LICENSE-APACHE First prototype 2021-07-02 21:11:28 +02:00
LICENSE-MIT First prototype 2021-07-02 21:11:28 +02:00
README.md MSRV 1.87.0 2025-12-01 23:12:09 +01:00
run_grcov.sh Added a linked list container type backed by a BTreeMap for O(log n) random access and O(1) for indexed, step by step, access. 2025-04-28 19:44:10 +02:00

Latest version Documentation workflow dependency status license

cpp_map.rs

C++ std::map Emulator for Rust

A simple C++ std::map emulator for Rust.

This library provides a data structure that emulates C++'s std::map, particularly its pointer-based cursors/iterators.

Key Features

  • Replicates C++ behavior where insert(key, value) is a no-op if the key exists (the new value isn't used)
  • Maintains pointer stability like C++'s std::map
  • Provides familiar C++-style iterator interface

Implementations

Skip List

  • O(log n) search and insert
  • O(1) sequential access

Linked List

  • O(n) search and insert
  • O(1) sequential access

Performance Note

For primarily position/hint-based operations, the linked list implementation will typically be faster.

Minimum Supported Rust Version (MSRV)

The minimum supported version of Rust for cpp_map is 1.87.0.

License

Licensed under either of

at your option.