Share via


An Tour of the STL.NET

Part of the (reasonably pleasant) distractions from posting on this blog recently has been working up the first in a series of articles on STL.NET for our Visual C++ MSDN web site. The amount of work to get from an articulation of a topic to a formal publication of it is an amazingly labor-intensive 10% -- similar to the difference between prototyping a software solution and making it deployment ready. In any case, this relatively content-free entry is just to alert you of its going on-line at

 

https://msdn.microsoft.com/visualc/?pull=/library/en-us/dnvs05/html/stl-netprimer.asp?frame=true

If for some reason, this doesn't show up in the post as a clickable link, you can just visit the visual c++ subportion of the msdn site at

 https://msdn.microsoft.com/visualc

 

and hopefully find a link to it there. In any case, the Visual C++ site, under the care and breeding of Brian Johnson and Ami Vora, has really been spiffed up with some very neat content and is worth a lookie-loo.

For the article, David Clark, who did a wonderful job editing the piece, asked me to come up with a summary limited to 200. I misread that as 200 words, and wrote the following. I then discovered to my chagrin that it referred to 200 characters, including white space. I thought, well, white space is without content, so if I remove that, I get perhaps another 75 characters to play with, but that doesn't actually work … In any case, here is the summary that had to be sliced mercilessly:

For the experienced programmer, the hardest part of moving to a new development platform such as .NET is often the absence of familiar tools through which she has honed her skills and on which she depends. For the experienced C++ programmer, one such essential toolkit is the Standard Template Library (STL), and its absence under .NET until now has been a significant disappointment. With Visual C++ 2005, we fix that by providing an STL.NET library. This article, the first in a series, provides a general overview of the STL program model using STL.NET – it discusses sequential and associative containers, the generic algorithms, and the iterator abstraction that binds the two, using plenty of program examples to illustrate each point. It begins by briefly considering the alterative container models available to the .NET programmer using C++ -- the existing System::Collections library, the new System::Collections::Generic library, and, of course, STL.NET. To provide for the widest readership, this article does not require familiarity with the STL library; however, it does presume some experience with the C++ programming language.

This summary, when reduced to 200 characters, plus the white space i threw back in, ended as follows:

 

With Visual C++ 2005, the Standard Template Library (STL) has been re-engineered to work under the .NET Framework. This article, the first in a series, provides a general tour of STL.NET.

 

Talk about a poor relative. In any case, this article is culled from a text I am writing on the C++ binding to the CLI, so if you have any concerns or comments or a content wish-list, please drop me a line.

Comments

  • Anonymous
    August 15, 2004
    Nice intro article, Stan. Thanks for it - was quite useful for me specially since I've never used STL before :-)

    I found the different naming style a little funny though - all the STL functions start with a small letter :-) But then I guess you had to retain that style for making it as similar to normal STL as possible.

  • Anonymous
    August 15, 2004
    well, you're becomming a veritable one person fan club -- but thank you. the naming conventions of the stl illustrate their historical roots in a non-object-oriented universe (in fact, alex is somewhat passionate in his dislike of OO programming) in which isA was is_a, and StringBuilder was strb -- ah, for the good old days ... wasn't that a time :-)

  • Anonymous
    August 16, 2004
    Thanks for interesting article!

    I've noticed that in the article both the System::Collections and System::Collections::Generic examples use "using namespace", while in STL.NET example the namespaces not even mentioned. Does it mean that STL.NET classes live in global namespace?

  • Anonymous
    August 16, 2004
    Was the misspelling of "Veritible" intended? Is there a pun somewhere later in the article on this?

  • Anonymous
    August 16, 2004
    no, it ws just myst ... thanks for giving me the benefit of the doubt :-0 ... dang.

  • Anonymous
    August 17, 2004
    At last, STL for .Net!

    I think the naming convention problem could be a show stopper. The naming convention of the STL would clash too heavily with .Net strict rules (I can hear FxCop scream).

    I'm really missing the concepts of iterators (IEnumerator is cool but not sufficient).

    A while ago, I also gave a shoot at doing some STL-ish things in .Net 2.0 ( http://blog.dotnetwiki.org/archive/2004/08/10/752.aspx ).

    Also, do you think "template" intensive such as Spirit,uBlas or boost could be ported to .Net ?

    Jonathan

  • Anonymous
    August 17, 2004
    show stopper sounds rather severe -- i wonder if you could elaborate on that? keep in mind that templates are internal to an assembly, and that we interface with the public through ICollection, IList, and IEnumerator. If you are missing the concept of iterators, blame me not yourself. I will over time post an article on them, and hopefully that will help get you over the conceptual bridge. i don't know the `modern' template libraries such as boost, except by reputation -- anso tsao, a colleague here at microsoft, could better speak to that.

  • Anonymous
    August 17, 2004
    Sorry, in fact "show stopper" is rather severe. Let me elaborate.

    .Net comes with a rather strict and complete naming guidelines ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconpropertynamingguidelines.asp ) which can be enforced with tools such as FxCop (developpped by Microsoft).

    Among the numerous guidelines, the most important (to me) are:

    - class names, public and protected methods, public properties, public fields should be capitalized,
    - private fields and method parameters should be CamelCase

    Therefore, STL does not follow such guidelines (of course, STL existed long beforfe .Net).

    I'm not blaming you for "missing the concept of iterators", in fact I'm thanking you for getting STL back into .Net.

    Cheers,
    Jonathan

  • Anonymous
    August 18, 2004
    thank you, jonathan. but many people other than myself deserve the credit for getting the STL back into .NET: Anson Tsao, Martyn Lovell, in particular, and P.J.Plauger, as well as others. In this case, I'm really just another enthusiast.

    again, with regard the naming conventions -- 1. as i suggested in my previous comment, templates are internal to an assembly and in that sense are exempt, i think, and 2. as you point out, their naming decisions `grandfather' these guidelines.

    thanks for getting back.

  • Anonymous
    August 28, 2004
    One blunder i made in the article was to not realize that List<T> is the Generic analog to (a) ArrayList, and (b) Vector. i just skimmed through the documentation a bit too fast, and it didn't register on me that List<T> could be used as the name of a capacity-based vector. so, the second example of a generic container should be List<T>, not Collection<T> ... List has a full interface ... and so on. My bad ...

  • Anonymous
    November 25, 2007
    PingBack from http://feeds.maxblog.eu/item_1128408.html

  • Anonymous
    June 12, 2009
    PingBack from http://insomniacuresite.info/story.php?id=7242