Last Friday I finally managed to get the NSTL 3.0 out of the door. Although most of the features were mature and ready more than 3 Months ago, I never managed to finish the automatic build process for the 3.x branch. Well, until last Friday!
Besides being compiled the first release written using C#3.0 features such as LINQ and extension methods, it offers a lot of functionality to integrate the NSTL and its C++ background seamless into .NET. Actually, using the new extension methods lets you use .NET and NSTL collections and algorithms seamlessly. For instance, you can use .NET collections with iterators in algorithms:
using.NUnit.Framework;
using NStl.Linq;//Import the extensions
List<int> list = new List<int>(){0,1,2,3};
ListTIterator<int> it = Algorithm.Find(list.Begin(), list.End(), 2);
Assert.That(it, Is.Not.EqualTo(list.End());
By being able to pimp up .NET BCL objects with extension methods, I was able to deprecate a whole lot of NSTL containers like Vector<T>, DList<T> and bulky adapter utility methods like NStlUtil.Begin(..).
Furthermore this release provides extension methods for the NSTL itself, enabling a smooth transition to .NET collections:
using.NUnit.Framework;
using NStl.Linq;//Import the extensions
List<int> list = new List<int>(){0,1,2,3};
ListTIterator<int> it =
Algorithm.Find(list.Begin(), list.End(), 2);
//range contains 0,1
IEnumerable<int> range = list.Begin().AsEnumerable(it);
Last but not least you will find LINQ overloads for the Cast<T> operators to cast dictionaries.
No comments:
Post a Comment