Skip to content

STL to M*LIB mapping

PpHd edited this page Feb 23, 2023 · 31 revisions
STL M*LIB Description Comment
pair tuple A pair of elements (a structure with 2 fields)
tuple tuple fixed-size ordered list of elements (a structure) M*LIB defines automatic methods
optional variant optional contained value M*LIB variant can be empty
variant variant A type-safe union
array NA fixed-size arrays Use plain C array?
valarray NA Kind of Math vector Use array + algo.
bitset bitset fixed-size sequence of N bits M*LIB bitsets are variable
string string variable sequence of characters Only char supported as character by M*LIB
vector array a variable collection of elements stored in a continuous way
list NA a variable collection of non-movable elements No doubly list available. Use singly or dual-push or intrusive list or deque
forward list list a variable collection of non-movable elements M*LIB lib is backward instead of forward.
deque deque a variable collection of non-movable elements
queue deque a variable collection of elements with FIFO policy Use directly deque or dual push list
stack array  a variable collection of elements with LIFO policy Use directly array or list or dual push list
priority queue prioqueue a variable collection of elements with priority policy
set B+TREE / rb-tree a fully ordered variable collection of elements
multiset B+TREE
map B+TREE an associative array fully ordered rb-tree can be used too.
multimap B+TREE
unordered_set set an variable collection of unique elements
unordered_multiset NA Use B+TREE
unordered_map dict an associative array associating keys to values
unordered_multimap NA Use B+TREE
unique_ptr NA The unique pointer to an object (owns it) Use plain old pointer instead
shared_ptr shared_ptr One of the pointers that owns an object
weak_ptr NA One of the pointers that has requested temporary access to an object
functional funcobj Function Object (functor)
algorithm algo  Different algorithms on containers
initializer_list  NA List at compile time for initialization  INIT_WITH method can be used instead.
flat_set  NA Set based on Sorted array. Use B+TREE instead
flat_map  NA Map based on Sorted array. Use B+TREE instead
flat_multiset  NA Multiset based on Sorted array. Use B+TREE instead
flat_multimap  NA MultiMap based on Sorted array. Use B+TREE instead
basic_string_view  NA Aliasing of sub strings
span  NA Aliasing of array
mdspan  NA Multidimension Aliasing of array
STL M*LIB Description Comment
NA? Bounded string Bounded string
NA dual push list List with push operations at both end, but only one pop operation Use STL list
NA Stored Hash Dict Dict that avoids recomputing heavy hash Use STL unordered_hash
NA Open Addressing Dict Dict that is more cache friendly Use STL unordered_hash
NA Bounded LB Queue Communication channel between thread as a queue NA
NA Bounded LB Stack Communication channel between thread as a queue NA
NA Bounded LF MPMC Queue Communication channel between thread as a queue NA
NA Bounded LF SPSC Queue Communication channel between thread as a queue NA
NA SPSC LF Snapshot Communication channel between thread as a snapshot NA
NA SPMC LF Snapshot Communication channel between thread as a snapshot NA
NA MPMC LF Snapshot Communication channel between thread as a snapshot NA
NA Bounded shared resource Shared Access to a limited pool of resources NA
NA Concurrent<> Meta container to build thread safe container NA

Note: There is no Dualy (non intrusive) linked list due to the low interest of this container compared to others. In every scenario I know, it is better (memory consumption, performance and/or easy to use) to use another container than this one.

Clone this wiki locally