Anyone use the C++ standard library?

Member
Posts: 749
Joined: 2003.01
Post: #1
I was thinking of using the C++ standard library for lists, but I dont seem to find decent documentation on the GCC implementation... (as usual it's more a "come help us" than a documentation).

Do you think I can use the documentation of "wave software's" implementation?

http://www.tacc.utexas.edu/services/user...stdlib.htm

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
does anyone /not/ use the C++ standard library?

I use SGI's docs: http://www.sgi.com/tech/stl/

but I really recommend this book: http://www.josuttis.com/libbook/index.html
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #3
thanks OSC! I just discovered it's existance by chance, none of the tutorials I read mentioned it, they all implemented their own string class Rasp

There are so many basic things I dont know, I guess it just takes time. With simple tools like blitzmax you just have 200 keywords to know and that's it.

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Hog
Member
Posts: 151
Joined: 2002.09
Post: #4
Those STL classes in particular that seem to be very useful to me are offically not supported at all (hash_map, in particular with strings as keys). I've had some negative experiences with the string class (as in weird crashes due to memory corruption). The rest of the stuff is ok i guess if you want to have a quick implementation of something, but i've not used much of it.
Quote this message in a reply
Member
Posts: 567
Joined: 2004.07
Post: #5
I use them, but not for rapid memory access... I wouldn't use them for example, for a mesh.

It's not magic, it's Ruby.
Quote this message in a reply
Moderator
Posts: 771
Joined: 2003.04
Post: #6
Quote:report on the C++ Library Extensions TR1, the next version of the Standard Libraries.
...
Austern explained changes in function libraries, built-in random number generators, and hash tables, which are now called "Unordered Associative Containers."
...
As currently proposed, regular expression handling in the C++ libraries will be similar to the Python model. The syntax is based on ECMAscript; it includes many options such as alternate syntaxes. (A PDF of the TR1 proposal is available here.

The language update schedule is indeed a slow one. The cutoff for C++0x proposals has just passed. Proposals are due in October 2006 for TR2. The cutoff for the C++0x "cleanup" are due by April 2007.

"If you have ideas for new C++ libraries," Austern said, "Now would be a good time to submit them."

From http://www.eweek.com/article2/0,1895,1884735,00.asp
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #7
I'm crazy and usually do everything myself. (such as linked lists, trees etc.) I suppose I could use the standard library, but this way I know it will do everything I want exactly how I want. Plus I learn a bit at the same time.
Quote this message in a reply
Member
Posts: 198
Joined: 2005.01
Post: #8
akb825 Wrote:I'm crazy and usually do everything myself. (such as linked lists, trees etc.) I suppose I could use the standard library, but this way I know it will do everything I want exactly how I want. Plus I learn a bit at the same time.

...and introduce subtle bugs because your code isn't as widely tested Wink

Re the string issues someone mentioned above, the std::string class has been improving steadily from what I understand. I've used it quite a bit recently and it's worked flawlessly. In general for a pretty widely used STL implementation, I wouldn't worry too much about bugs in the library. It's more of subtle usage problems if you do things they didn't intend for you to do. (Sorry, I'm too stuffed with turkey et al to remember a good example right now... Smile)

Cryptic Allusion Games / Cryptic Allusion, LLC
http://www.cagames.com/
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #9
Whenever I've made a data structure so far it's been for a specific purpose and rather simple. I always double check to make sure it will hold up against all the cases I'll use and that it doesn't have memory leaks with a test driver program.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #10
I use STL every-bloody-where, and then Shark it. My reasoning is that I can not know beforehand how large data sets I will end up with, and if an O(n**2) implementation will be acceptable or not. While "postpone all optimization" adage doesn't necessarily hold true, I wait until I know what my datasets will be and decide on it then. For instance, I ran with an STL vector for sorting 10000+ objects on level load for pretty long. It turned up in Shark as a huge culprit so I took a long hard look at it and switched to a bucket sort. It dropped cleanly off the profile. How could this be? Well, I noticed that those 10k objects belonged to one of only five types, and that the internal order of them was of little importance. A bucket sort runs in O(n). However, I could never have expected this when I set out, since I had no idea what kind of data I would end up with.

In general, when optimizing, you shouldn't worry too much about performance when developing. Shark your application once a week, just so you know what is going on. Try to keep apparent performance problems in check as you go, but don't try to wring every last cycle out of a snippet that sorts a data set of a hundred objects once per level.

When optimization talk comes up, I always bring out this war story: I was contracted to port and optimize a physics-heavy FPS engine that ran about 35% slower on the Mac than on Windows. The reason? A bad custom implementation of strcmp().
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #11
I just need variable size arrays.

From what I understand vectors are just like arrays that are destroyed and rebuilt bigger when it exceeds the capacity, while linked lists keep objects in nonconsecutive memory addresses using the trick of the iterator (so you dont have to destroy everything once you exceed the capacity)

The stuff in the standard library looks all very interesting (really "powerfull" and "general"), I guess you learn a big deal about "modular" programming studying them

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Standard C++ Carbon Application Template AdrianM 2 3,447 Jun 29, 2009 04:51 AM
Last Post: AdrianM