#cpp #map

cpp_map

A simple C++ std::map emulator

5 releases

0.1.1 Jul 29, 2021
0.1.0 Jul 19, 2021
0.0.3 Jul 11, 2021
0.0.2 Jul 3, 2021
0.0.1 Jul 2, 2021

#687 in Rust patterns

Download history 19/week @ 2021-08-15 12/week @ 2021-08-22 15/week @ 2021-09-05 4/week @ 2021-09-12 8/week @ 2021-09-19 31/week @ 2021-09-26 24/week @ 2021-10-03 38/week @ 2021-10-10 52/week @ 2021-10-17 27/week @ 2021-10-24 18/week @ 2021-10-31 36/week @ 2021-11-07 24/week @ 2021-11-14 31/week @ 2021-11-21 27/week @ 2021-11-28

120 downloads per month
Used in 4 crates (via boostvoronoi_core)

MIT/Apache

60KB
1.5K SLoC

Latest version Documentation Workflow Workflow dependency status

cpp_map.rs

A simple C++ std::map emulator for Rust. Probably not useful for anyone.

I needed a data structure that could emulate a C++ std::map, and it's pointer based iterators. More specifically it needs to emulate the insertion position hint functionality as the keys I intend to use are not entirely transitive. i.e., searching for insertion position from the head or tail makes a big difference.

I also needed to be able to replace the key of an already inserted item w/o altering the order. - Don't ask.

Another gotcha is that a C++ std::map::insert(key, value) is a NOP if the key already exists, not even the new value will be used.

The current implementation uses a double linked Vec list, and it only supports sequential search.

License

Licensed under either of

at your option.

Dependencies

~340–770KB
~19K SLoC