[Mono-list] STL in .net
Rafael Moncayo
moncayorafa@netscape.net
Wed, 05 Jun 2002 23:44:18 -0500
Every comment about my english is welcome.
Yes, I know... its dificult to leave the past, but I feel .Net does'nt
have a good Iterator interface where you can go foward and backward in a
collection. Worst, your enumerator become invalid when you add or remove
items from a collection.
This problem arise to me when I try to work width graphs where you need
a lot of control of your data structures.
So is there any work about STL (or similar) in c#?
How do mono people work with data structures?
I have make a set of classes and interfaces to simulate a std::list. So
look at this code:
using System;
using STD;
class MainClass
{
public static void Main(string[] args)
{
List l = new List();
l.PushBack("one");
l.PushBack("two");
l.PushBack("three");
// IEnumerator flavor
foreach (Object o in l)
Console.WriteLine("\t{0}", o);
// STL flavor
for (Iterator i = l.Begin(); MoveNext(); )
Console.WriteLine("\t{0}",i.Current);
// STL flavor in reverse order
for (Iterator i = l.RBegin(); i.MoveNext(); )
Console.WriteLine("\t{0}",i.Current);
}
}
I don't believe i'm the only one with this problem. I have to work more
in making a set of interfaces similar to STL? or learn more about
standard .net classes an forgive everything about c++ and stl?