一个老外他自己对于c++ STL容器的c#的等同物的看法I generally use the following to replicate similar data structures from the STL. std::vector - List<T> std::list - LinkedList<T> std::map - Dictionary<Tkey, Tvalue> std::set - Dictionary<Tkey, Tvalue> (with null values) std::multimap - Dictionary<Tkey, List<Tvalue>> std::multiset - Dictionary<Tkey, int> (with int keeping count of the number of Tkeys)
没有这个集合~~~~要自己写一个算法: 算法思路如下:目标集合A 1.定义一个源集合B, 2.让后往B 中添加A 的元素 需要判定 foreach(string str in A) { if(B.Contains(str)) continue; else B.Add(str); } 3.返回B ,就是自己所需的。
std::vector - List<T>
std::list - LinkedList<T>
std::map - Dictionary<Tkey, Tvalue>
std::set - Dictionary<Tkey, Tvalue> (with null values)
std::multimap - Dictionary<Tkey, List<Tvalue>>
std::multiset - Dictionary<Tkey, int> (with int keeping count of the number of Tkeys)
算法思路如下:目标集合A
1.定义一个源集合B,
2.让后往B 中添加A 的元素
需要判定
foreach(string str in A)
{
if(B.Contains(str))
continue;
else
B.Add(str);
}
3.返回B ,就是自己所需的。