The use of STL has dramatically changed the way code in C++.
Unfortunately, we are receiving posts that reflect some pitfalls of STL.
I request everyone to share their bad experiences they had, in solving a problem using STL so that we all can be aware of it.
Although, I did not yet suffer, but I got poor timing in solving a problem, and i am sure it is due to using STL, because an alternate solution without STL, solved at a much less time.
STL Benefits and Pitfalls
Moderator: Board moderators
-
- New poster
- Posts: 22
- Joined: Sun Oct 20, 2002 6:41 pm
- Location: Lithuania
- Contact:
Where is the alternative "I've had no problems with STL"? 
There are at least two necessary conditions for STL code to be roughly as fast as (well written) "normal" code:
# The STL code is also well written.
# The STL code is compiled with some optimisation, so that methods like the []-operator for vector and many other get inlined. Sadly, this is often not the case in programming contest environments.
But as Viktoras said, you'll still only get a constant factor worse by using STL (as long as you're using it correctly).
And of course, just using cin/cout (not STL, but still a related issue) is extremely slow compared to scanf/printf, since by default, all iostream operations get synchronised with stdio. (Though it is possible to disable this synchronisation.)

There are at least two necessary conditions for STL code to be roughly as fast as (well written) "normal" code:
# The STL code is also well written.
# The STL code is compiled with some optimisation, so that methods like the []-operator for vector and many other get inlined. Sadly, this is often not the case in programming contest environments.
But as Viktoras said, you'll still only get a constant factor worse by using STL (as long as you're using it correctly).
And of course, just using cin/cout (not STL, but still a related issue) is extremely slow compared to scanf/printf, since by default, all iostream operations get synchronised with stdio. (Though it is possible to disable this synchronisation.)
-
- Experienced poster
- Posts: 202
- Joined: Fri Mar 22, 2002 2:00 am
- Location: Chittagong. CSE - CUET
- Contact:
"I had some other problem"
That's I am not well user of it!
And as said earlier... it's my problem, not STL...
Actually they are very good stuff.....done lots of advaced things with it
And you should practice them with GNU C++ compiler
By downloading from sgi..........that will reduce your RTEs.
That's I am not well user of it!

And as said earlier... it's my problem, not STL...

Actually they are very good stuff.....done lots of advaced things with it

And you should practice them with GNU C++ compiler
By downloading from sgi..........that will reduce your RTEs.
