Crate cpp_map[][src]

Expand description

A simple data structure emulating a C++ std::map. 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 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 std::vec::Vec list, and it only supports sequential search.

Structs

A double linked min list. The head (top/front) of the list is the first item. Sorted Order::Less than other items. The tail (bottom/back) is the last item of the list. Sorted Order::Greater than other items.

A double ended iterator

An effort to emulate a C++ std::map iterator in Rust. It will have functionality like: prev(), next(), get(), erase(), lower_bound(), replace_key()

Enums

Constants

Indicates that an iterator has passed beyond the limits of the list.