C#stl [英] C# stl

查看:71
本文介绍了C#stl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在学习C#之前用C ++开发,我总觉得

..NET遗失了一些东西。具体来说,这个角色充满了STL的作用。


考虑到这一点,我已经推出了一个开源项目来创建一个

STL喜欢C#2.0中的库。该项目名为CSTL,可从sourceforge.net获得



http://sourceforge.net/projects/cstl


该库是pre-alpha,不完整,尚未准备好黄金时段使用。

然而,概念已经到位了。


以下是Count算法的一个例子:


int [] values = new int [] {1,2,3,2,2,4,5,2};

int count = Algorithm.Count(values,2);

以下是CopyIf算法和后插入迭代器的示例


int [] values = new int [] {1,2,3,2,2, 4,5,2};

List< int> dest = new List< int>();


Algorithm.CopyIf(values,IteratorUtil.BackInserter(dest)

delegate(int x){return x> ; 2;});


// dest现在包含{3,4,5}


还有其他类似的项目。但是,他们似乎都没有对我这么好。通常,他们没有迭代器概念,或者他们使用非符合CLS的方式使用C ++。


欢迎提供反馈。


H ^ 2

从电子邮件地址删除.bounce。


Having developed in C++ prior to learning C#, I have always felt like
..NET was missing something. Specifically, something that fills the role
of the STL.

With that in mind, I have launched an open source project to create an
STL like library in C# 2.0. The project is called CSTL, and is available
from sourceforge.net:

http://sourceforge.net/projects/cstl

The library is pre-alpha, incomplete and not ready for primetime use.
However, the concepts are pretty much in place.

Here is an example of the Count algorithm:

int [] values = new int[] {1,2,3,2,2,4,5,2};
int count = Algorithm.Count(values, 2);
Here is an example of the CopyIf algorithm and back insertion iterators

int [] values = new int[] {1,2,3,2,2,4,5,2};
List<int> dest = new List<int>();

Algorithm.CopyIf(values, IteratorUtil.BackInserter(dest)
delegate(int x) { return x>2;});

// dest now contains {3,4,5}

There are other projects like this out there. However, none of them seem
quite right to me. Usually, they don''t have an iterator concept, or they
use C++ in non CLS compliant ways.

Feedback is welcome.

H^2
Remove .bounce from email address.

推荐答案

哈罗德,


我认为在你走得太远之前,你应该看看

LINQ,看看你在做什么之间的重叠什么是

在那里展示。有许多相似的概念,我会讨厌看到你做了这么多的工作,最终只能由MS提供



-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Harold Howe" < HH *********** @ mchsi.com>在消息中写道

news:%2 **************** @ TK2MSFTNGP05.phx.gbl ...
Harold,

I think that before you take this too far, you should take a look at
LINQ, and see the overlap between what you are doing, and what is going to
be presented there. There are many concepts that are similar, and I would
hate to see you do so much work which is only going to end up being provided
by MS.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Harold Howe" <hh***********@mchsi.com> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
缺少一些东西。具体而言,它充满了STL的作用。

考虑到这一点,我已经启动了一个开源项目来在C#2.0中创建一个类似STL的库。该项目名为CSTL,可从
sourceforge.net获得:

http://sourceforge.net/projects/cstl

该库是预先alpha版,不完整版,尚未准备好黄金时段使用。
然而,这些概念这是一个Count算法的例子:

int [] values = new int [] {1,2,3,2,2 ,4,5,2};
int count = Algorithm.Count(values,2);

这是一个CopyIf算法和后插入迭代器的例子

int [] values = new int [] {1,2,3,2,2,4,5,2};
List< int> dest = new List< int>();

Algorithm.CopyIf(values,IteratorUtil.BackInserter(dest)
delegate(int x){return x> 2;});

// dest现在包含{3,4,5}

还有其他类似的项目。但是,他们似乎都没有对我这么好。通常,他们没有迭代器概念,或者他们以非符合CLS的方式使用C ++。

欢迎反馈。

H ^ 2
从电子邮件地址中删除.bounce。

Having developed in C++ prior to learning C#, I have always felt like .NET
was missing something. Specifically, something that fills the role of the
STL.

With that in mind, I have launched an open source project to create an STL
like library in C# 2.0. The project is called CSTL, and is available from
sourceforge.net:

http://sourceforge.net/projects/cstl

The library is pre-alpha, incomplete and not ready for primetime use.
However, the concepts are pretty much in place.

Here is an example of the Count algorithm:

int [] values = new int[] {1,2,3,2,2,4,5,2};
int count = Algorithm.Count(values, 2);
Here is an example of the CopyIf algorithm and back insertion iterators

int [] values = new int[] {1,2,3,2,2,4,5,2};
List<int> dest = new List<int>();

Algorithm.CopyIf(values, IteratorUtil.BackInserter(dest)
delegate(int x) { return x>2;});

// dest now contains {3,4,5}

There are other projects like this out there. However, none of them seem
quite right to me. Usually, they don''t have an iterator concept, or they
use C++ in non CLS compliant ways.

Feedback is welcome.

H^2
Remove .bounce from email address.



我认为在你走得太远之前,你应该采取看看LINQ,看看你在做什么,以及将要在那里展示的重叠。
I think that before you take this too far, you should take a look at
LINQ, and see the overlap between what you are doing, and what is going to
be presented there.




谢谢你建议和提醒。 C#3.0需要多长时间才能用于生产?从我能找到的一点点来看,Orcas看起来好像可能会在2007年下半年出现。从过去的
经验来看,我知道还需要4个月的时间或者直到我的
小组采用它。


最糟糕的情况是LINQ使CSTL完全无关紧要。如果

这是真的,并且它发生在2008年上半年或之后,那么对于我个人而言,CSTL的开发将是值得的。 />
因为我现在需要它的一些功能。


如果C#3.0在2005年发布用于生产,那么我可能会更改我的
$ b $我猜是猜。在Orcas之前是否有机会发布C#3.0?


H ^ 2



Thanks for the suggestion and the heads up. How long until C# 3.0 is
ready for production use? From what little I could find, Orcas is
looking like it may come in the second half of 2007. From past
experience, I know it would take an additional 4 months or so until my
group adopts it.

Worst case scenario is that LINQ renders CSTL completely irrelevant. If
that is true, and it happens in the first half of 2008 or later, then
the developement of CSTL, for me personally, will have been worth it
because I need some of its features now.

If C# 3.0 is released for production use in 2005, then I might change my
tune I guess. Is there a chance that C# 3.0 would be released before Orcas?

H^2


Hello Harold,


尼古拉斯只是想指出周围有太多的东西需要改善,而不是那个很快会在
$ b中实现的smth。 $ b b框架边界:)


例如,你可以帮助来自Nemerle的人( www.nemerle.org )实现

这些功能:)
Hello Harold,

Nicolas wanted just point that there are too much things around that need
to be improved, rather that doing smth that will be realized soon in the
bounds of framework :)

For example, you can help guys from Nemerle (www.nemerle.org) to realize
these features :)
I我认为在你走得太远之前,你应该看看LINQ,看看你在做什么,以及将要在那里展示什么。
I think that before you take this too far, you should take a look at
LINQ, and see the overlap between what you are doing, and what is
going to be presented there.



HH>感谢您的建议和提醒。到C#3.0需要多长时间

HH>准备生产用?从我能找到的一点点来看,Orcas是

HH>看起来可能会在2007年下半年出现。从过去

HH>经验,我知道需要额外的4个月左右,直到

HH>我的团队采用它。

HH>

HH>最糟糕的情况是LINQ使CSTL完全不相关。

HH>如果这是真的,它发生在2008年上半年或之后,

HH>那么对于我个人而言,CSTL的发展将是

HH>值得,因为我现在需要它的一些功能。

HH>

HH>如果C#3.0在2005年发布用于生产,那么我可能会给b $ b HH>我想改变我的调子。 C#3.0是否有机会

HH>在Orcas之前发布了吗?


---

WBR,
http://spaces.msn.com/laflour


"有时一个人仍然忠实于一个事业,只因为它的对手不会b / b不再是平淡的。 (c)Friedrich Nietzsche


HH> Thanks for the suggestion and the heads up. How long until C# 3.0 is
HH> ready for production use? From what little I could find, Orcas is
HH> looking like it may come in the second half of 2007. From past
HH> experience, I know it would take an additional 4 months or so until
HH> my group adopts it.
HH>
HH> Worst case scenario is that LINQ renders CSTL completely irrelevant.
HH> If that is true, and it happens in the first half of 2008 or later,
HH> then the developement of CSTL, for me personally, will have been
HH> worth it because I need some of its features now.
HH>
HH> If C# 3.0 is released for production use in 2005, then I might
HH> change my tune I guess. Is there a chance that C# 3.0 would be
HH> released before Orcas?

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche


这篇关于C#stl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆