社区
C#
帖子详情
C#中有类似于C++的STL中的SET容器吗?
f22fbi
2009-04-20 11:15:31
C#中有类似于C++的STL中的SET容器吗?
...全文
541
4
打赏
收藏
C#中有类似于C++的STL中的SET容器吗?
C#中有类似于C++的STL中的SET容器吗?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
zcshan1982
2009-04-21
打赏
举报
回复
这个真没有!
riveryeah
2009-04-21
打赏
举报
回复
没见过,应该没有吧
wartim
2009-04-21
打赏
举报
回复
c++ stl 容器好像没有直接对应的c#容器,不过list<>也差不多啦。唯一不同就是不是set那样的相同元素只能有一个
soaringbird
2009-04-21
打赏
举报
回复
有各种容器
C++
The Complete Reference, 4th Edition - Copy
If there is one language that defines modern programming, it is
C++
. Its syntax, style, and philosophy have
set
the standard by which all other languages are judged. Furthermore,
C++
is the universal language of programming. When an algorithm or technique is described, it is usually done so using the
C++
syntax. The long-term success of
C++
has also left a lasting impression on computer language development. For example, both Java and
C#
are descended from
C++
. Frankly, to be a professional programmer implies proficiency in
C++
. It is the one language that no programmer can afford to ignore. This is the fourth edition of
C++
: The Complete Reference. It fully describes and demonstrates the keywords, syntax, functions, classes, and features that define the
C++
language. More specifically, this book fully describes Standard
C++
. This is the version of
C++
defined by the ANSI/ISO Standard for
C++
and it is the version of
C++
that is supported by all major compilers, including Microsoft’s Visual
C++
and Borland’s
C++
Builder. Thus, the information in this book is applicable to all modern programming environments. In the time that has passed since the previous edition of this book, there have been no changes to the
C++
language. There have, however, been big changes to the computing environment. For example, a new standard for C, called C99, was created, Java became the dominant language for Web programming, the .NET Framework was
C++
-specific features. Part Two discusses in detail the features that move beyond the C foundation and define the
C++
language These include its object-oriented features such as classes, constructors, destructors, RTTI, and templates. Thus, Part Two covers those constructs that “make
C++
,
C++
.” Part Three describes the standard function library and Part Four examines the standard class library, including the
STL
(Standard Template Library). Part Five shows two practical examples of applying
C++
and object-oriented programming.
(
C#
.Java.Python)
类似
于
C++
STL
的方法
C++
的
STL
是一个非常好用的东东。用过了就回不去了,因为
STL
里面已经写好了数据结构,就算要自己自定义数据结构也是非常容易的。那么在使用其他语言的时候也想像使用
STL
一样潇洒,也是可以的。
C++
——
STL
_demo #include<iostream> #include<vector> #include<list> #include<map> #...
C#
与
C++
STL
的
容器
对应说明
DotNet下的泛型
容器
类封装在System.Collections.Generic,使用的十分广泛。
C++
则靠
STL
实现了泛型
容器
与算法。下面对二者做一个对比,只谈用法,不深究原理。对比的内容有数组、链表和字典三种结构。 一、数组
C#
使用List,
C++
用的是std::vector,内部实现都是数组,也就是一块连续的内存区域,插入、删除操作慢,随机访问速度快。 操作
STL
中
的
set
1.关于
set
关于
set
,必须说明的是,
set
是一种关联式
容器
。
set
作为一个
容器
也是用来存储同一数据类型的数据类型,并且能从一个数据集合
中
取出数据,在
set
中
每个元素的值都唯一,而且能根据元素的值自动进行排序。应该注意的是
set
中
数元素的值不能直接被改变。 在
C++
STL
中
,标准关联
容器
如:
set
, multi
set
, map, multimap,内部采用的是一种非常高效的平衡检索二叉树:红黑
c#
编程知识:高效使用
STL
高效使用
STL
仅仅是个选择的问题,都是
STL
,可能写出来的效率相差几倍; 熟悉以下条款,高效的使用
STL
; 当对象很大时,建立指针的
容器
而不是对象的
容器
1)
STL
基于拷贝的方式的来工作,任何需要放入
STL
中
的元素,都会被复制; 这也好理解,
STL
工作的
容器
是在堆内开辟的一块新空间,而我们自己的变量一般存放在函数栈或另一块堆空间
中
;为了能够完全控制
STL
自己的元素,为了能在自己的地盘随...
C#
110,537
社区成员
642,576
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章