Thread: STL for fun and profit

  1. #1
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301

    STL for fun and profit

    Since this is a C++ (and not a C) board, there is no reason why the members shouldn't use STL (unless their compiler doesn't support it).

    STL contains numerous classes that make your programming life easier:
    - a more intuitive string
    - a more flexible and dynamice array (vector)
    - quality sorting functions
    - algorythm-related functions
    and many more...

    If you have a good understanding of C++ there is no reason why you shouldn't learn yourself some STL.

    Here are a few good STL sites i found:
    http://www.mochima.com/tutorials/STL.html
    http://www.sgi.com/tech/stl/table_of_contents.html
    http://www.halpernwightsoftware.com/.../quickref.html

    read away, and happy coding!

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    I fully agree. Although in some circumstances it is more advantageous to write your own algorithm, the STL can greatly reduce the amount of time spent on projects. I love the string class, this alone is enough for me to use STL. Some of the classes are so generic that they can be slow in a time crucial application (I.E. - Gaming) but those can be individually improved. So yes, if you do not know about the STL go read! Don't be scared!!
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    You have to know the strengths and weaknesses of each container type. The STL is not slow, but you have to know what you are doing, which is a product of studying and working with the STL. I think that it is the best way to approach understanding class implimentation and object interaction, as well as OOA/D. Through the STL you can see the real difference between C and C++. The new update to the C++ standard will introduce build upon the existing STL. It will be interesting to see the new features.

  4. #4
    Unregistered
    Guest
    In theory I agree, also. In fact, eventhough my compiler is not STL compliant, (or namespace compliant for that matter), I think it is useful for those who don't have STL to read about it. It is a good demonstration of classes, templates, etc. (IMO, use of iterators seems more involved than use of pointers but it doesn't seem that difficult.) Indeed, I have downloaded an STL class (from SGI if I remember correctly), but the instruction set for it's use really turned me off, so I balk at using it. Also, at the gut level, I feel people should learn the C++ behind STL before they use the premade classes, but that could be considered prudish as well. After all I have no problem driving my car or using my television eventhough I have only the vaguest idea how either one works "under the hood" or "behind the screen" and for that matter there's a lot I still don't know about i/o classes, etc. either. Therefore, if you have STL, use it. If you don't, don't shy away from learning about it once you have the basics of C++ under your belt.

  5. #5
    Registered User
    Join Date
    May 2002
    Posts
    85

    Re: STL for fun and profit

    Originally posted by Aran Elus
    Since this is a C++ (and not a C) board, there is no reason why the members shouldn't use STL (unless their compiler doesn't support it).

    STL contains numerous classes that make your programming life easier:
    - a more intuitive string
    - a more flexible and dynamice array (vector)
    - quality sorting functions
    - algorythm-related functions
    and many more...

    If you have a good understanding of C++ there is no reason why you shouldn't learn yourself some STL.

    Here are a few good STL sites i found:
    http://www.mochima.com/tutorials/STL.html
    http://www.sgi.com/tech/stl/table_of_contents.html
    http://www.halpernwightsoftware.com/.../quickref.html

    read away, and happy coding!
    This advantage of C++ STL is only useful in develop for certain applications but not quite support in wide range of software applications.
    For example, STL is avoided to use in real-time
    embedded or network applications where the code
    require to run faster (C++ STL produce overhead).
    if implement a network communication software
    for router or DSP, most C/C++ programmers usually
    try to stay away from STL.

    DV007
    "Seeing is Believing!"

  6. #6
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    Many C++ers couldn't use it if their life depended on it, instead they use something much worse, ...Monopoly. Fake programming.

  7. #7
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    When I spoke with Stroustrup about this, he said that most of the back end of applications is STL. Face it though, many of you guys simply do not know how to use the C++ STL and therefore you don't know how to program in Standard C++. That is the reality. In my opinion the C++ STL is faster than building your own STL, it just makes more sense to use the Standard tested C++ library.

  8. #8
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301
    i agree with TK here... Alot of people look down on the STL because they don't know it. Also, people are using give-in type things (as in "it produces overhead") as excuses not to use it, even though they haven't even tried! Let me tell you, anything you use produces overhead, so that's a rather worthless excuse. It isn't like STL is eating up a tremendous amount of memory or anything. Sooner or later, the amount of memory and processing time you save by not using STL will become completely negligible with the advent of the terrabyte HD and the faster processors (3+ GhZ).

    There comes a time where you must admit that STL makes C++ much better a langauge than you may think.
    Time to buckle down and start learnin'!

  9. #9
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    The thing that I find weird is that they think that their own libraries are more efficient than the STL. I have never seen anyone on this board who I believe is capable of this.

  10. #10
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    isn't it time for you to retire from this board? I agree that STL is fast but you're a damn jerk. MS windows is not a competitor for STL for crying out loud.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  11. #11
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    MS Windows IS A MONOPOLY! You will get whatever MS decides to spoon feed you, and you can shut up and take it, no questions.

  12. #12
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >The thing that I find weird is that they think that their own libraries are more efficient than the STL. I have never seen anyone on this board who I believe is capable of this.

    What about you ? You might be capable.

  13. #13
    Earth_King
    Guest
    Originally posted by Aran Elus
    i agree with TK here... Alot of people look down on the STL because they don't know it. Also, people are using give-in type things (as in "it produces overhead") as excuses not to use it, even though they haven't even tried! Let me tell you, anything you use produces overhead, so that's a rather worthless excuse. It isn't like STL is eating up a tremendous amount of memory or anything. Sooner or later, the amount of memory and processing time you save by not using STL will become completely negligible with the advent of the terrabyte HD and the faster processors (3+ GhZ).

    There comes a time where you must admit that STL makes C++ much better a langauge than you may think.
    Time to buckle down and start learnin'!
    What make you people to jump to a conclusion that C++ programmers have never tried on using STL? It needs to be fair without bias and conservative when discussing about a programming language. For many years in software development, I have found that C++ STL is much slower than C macros, especially for develope the real-time apps. I totally agree with DV007 that STL is slow in speed such as real-time server, mission-critical embedded software....ect

    Folks! don't let your conservative mind to blind you in judgement.

    Earth_King

  14. #14
    Registered User Aran's Avatar
    Join Date
    Aug 2001
    Posts
    1,301
    >> conservative mind

    i'm far from conservative. A conservative wouldn't use STL because it isn't "core C++".

    In other news, STL would operate on a higher level aplication than what you are speaking of. STL is meant to operate on a higher level aplication anyway.

    And if i wanted all of my code to be fast as hell, i'd do it in C anyway.

  15. #15
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    Windows and the STL are not mutually exclusive. My game (see sig) runs in windows and uses the STL quite a bit.
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Find max profit among input salary
    By hlam in forum C Programming
    Replies: 8
    Last Post: 11-16-2008, 10:30 AM
  2. Programming for fun and profit
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 41
    Last Post: 12-16-2004, 04:52 PM
  3. Open Source and profit...
    By amzolt in forum C Programming
    Replies: 2
    Last Post: 03-28-2002, 09:13 AM