C++和.net的集合类对应
2016-07-03 21:31
369 查看
Here's what I've found (ignoring the old non-generic collections):
Array - C array, though the .NET Array can have a non-zero starting index.
List<T> - std::vector<T>
Dictionary<TKey, TValue> - unordered_map<Key, Data>
HashSet<T> - unordered_set<Key>
SortedDictionary<TKey, TValue> - std::map<Key, Data>
SortedList<TKey, TValue> - equivalent to a std::vector<T> but keeping it ordered by using binary search + insert when adding elements.
SortedSet<T> - std::set<Key>
Queue<T> - std::queue<T>
Stack<T> - std::stack<T>
LinkedList<T> - std::list<T>
Notably missing from the .NET collections are the "multi-" variants, e.g., multiset, multimap, etc. However, they have added a number of very useful threadsafe collections: the "Concurrent-" variants, e.g., ConcurrentDictionary, ConcurrentQueue, etc.
相关文章推荐
- c++并发编程小记1
- 斐波那契数列
- C语言中返回字符串函数的四种实现方法
- openssldescbc算法c++版
- Morris Traversal方法遍历二叉树(非递归,不用栈,O(1)空间)
- opensslmd5算法源码c++版
- VS2012C++学习笔记1(第1-2章)
- 华为OJ——名字的漂亮度
- 华为OJ——迷宫问题
- 华为OJ——学英语
- 华为OJ——称砝码
- 华为OJ——输入一行字符,分别统计出包含英文字母、空格、数字和其它字符的个数
- 华为OJ——判断两个IP是否属于同一子网
- 华为OJ——求小球落地5次后所经历的路程和第5次反弹的高度
- 华为OJ——统计每个月兔子的总数
- 华为OJ——字符串加密
- 华为OJ——蛇形矩阵
- 华为OJ——图片整理
- 华为OJ——整数与IP地址间的转换
- 华为OJ——字符串运用-密码截取