Map, set, multimap, and multiset in stl.

Source: Internet
Author: User
Finally, I have the opportunity to have the motivation to view jjhou's STL source code parsing. It is expected that the entire book will be read in the fast-reading mode. The underlying mechanisms of map and set are RB-Tree (red-black Tree), and insertion and search are O (lgN) complexity. Map and set have been heard before, but they are never used, because they do not know what is behind them. I read this book to learn about it.

Finally, I have the opportunity to have the motivation to view jjhou's STL source code parsing. It is expected that the entire book will be read in the fast-reading mode. The underlying mechanisms of map and set are RB-Tree (red-black Tree), and insertion and search are O (lgN) complexity. Map and set have been heard before, but they are never used, because they do not know what is behind them. I read this book to learn about it.

Finally, I have the opportunity to have the motivation to view jjhou's STL source code parsing. It is expected that the entire book will be read in the fast-reading mode.

The underlying mechanisms of map and set are RB-Tree (red-black Tree), and insertion and search are O (lgN) complexity. Map and set have been heard before, but they are never used, because they do not know what is behind them. I have read this book to understand the mechanisms behind it and may be used in the future.

Multimap and multiset are nothing but small modifications to map and set.

In addition, there are hash_map and hash_set. The underlying mechanism is not RB-Tree, but hash table.

After learning about this, map and set are all mysterious and controllable.

There is another point that needs to be explored: memory management. How can we customize the simple_allocator line of STL? Let's take a look.

The best reference for stl is cplusplus.com.

Let's talk about OceanBase and STL.

In OceanBase, there is almost no function provided by stl, basically repeating the "Wheel of invention", but this invention seems reasonable to some extent, for example: customization of return codes and Error Codes provides great flexibility. The customization of memory usage is also much larger. In addition, it is also lightweight. In addition, STL interfaces also have a headache. A large piece of code is switched around the interface, and there are also ways to avoid it. It looks much better to use typedef. Why does OceanBase not use STL? I think the essence is that we have a group of awesome engineers who can write the tested underlying code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.