C++ 中是否有对应的类作为 Java 中的 TreeMap?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5206749/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 09:57:46  来源:igfitidea点击:

is there corresponding class in C++ as TreeMap in Java?

javac++

提问by Don Lun

is there corresponding class in C++ as TreeMap in Java? thanks

C++ 中是否有对应的类作为 Java 中的 TreeMap?谢谢

回答by James McNellis

Yes, std::map, found in the <map>Standard Library header.

是的,std::map<map>标准库标题中找到。

回答by duffymo

I think an STL map might be what you want.

我认为 STL 地图可能是您想要的。

Its implementation might be different; I believe it's based on a red-black tree.

它的实现可能会有所不同;我相信它是基于红黑树的。