It is currently Sun May 28, 2017 8:52 pm

All times are UTC - 5 hours




 Page 1 of 1 [ 10 posts ] 
Author Message
 Post subject: some c++ tutorials on STL libraries
PostPosted: Fri Jun 27, 2008 2:10 pm 

Joined: Fri Jan 04, 2008 2:11 pm
Posts: 72
It'd be nice if u made some c++ tutorials on STL libraries like maps,vectors,lists and queues, inserting in them searching,sorting and deleting etc..also error handling(try catch stuff) , templates and trees.


Offline
 Profile  
 
 Post subject:
PostPosted: Fri Jun 27, 2008 8:08 pm 

Joined: Thu Oct 25, 2007 9:49 pm
Posts: 33
arent there lots of those online?


Offline
 Profile  
 
 Post subject: Re: some c++ tutorials on STL libraries
PostPosted: Sat Jun 28, 2008 5:47 am 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
ir2pi wrote:
It'd be nice if u made some c++ tutorials on STL libraries like maps,vectors,lists and queues, inserting in them searching,sorting and deleting etc..also error handling(try catch stuff) , templates and trees.


VMK10A/B in the C++ series covers STL usage: http://www.marek-knows.com/downloadSect ... pg=1#Cpp12

Let me know if you want me to expand on these.


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Jun 28, 2008 3:41 pm 

Joined: Fri Jan 04, 2008 2:11 pm
Posts: 72
thnkz, i looked into them...the reason i was asking is because i will be participating in a coding contest and using the STL seems a time saving way of programming....i don't know whether going into more detail will help....

plus can u give some tips on fast programming?? ie #defining which keywords etc ??


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Jun 28, 2008 4:06 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
ir2pi wrote:
plus can u give some tips on fast programming?? ie #defining which keywords etc ??


I'm not sure what you mean by fast programming


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Jun 28, 2008 4:35 pm 

Joined: Fri Jan 04, 2008 2:11 pm
Posts: 72
just ways to reduce keypresses....like using

#define FOR(a,b) for(int i=(a),j=(b);i<=j;i++)


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Jun 28, 2008 5:11 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
I believe that using #define statements in this fashion results in poor code so I try to avoid programming this way.

I much rather create a class to handle tasks for me.


Offline
 Profile  
 
 Post subject:
PostPosted: Sat Jun 28, 2008 5:15 pm 

Joined: Tue May 01, 2007 2:55 pm
Posts: 96
Location: Behind you
It does indeed create "bad code", but if you are in a coding contest (where you can't use a premade class, but can memorize some define statements and type them as the very first thing you do) where time is the primary constraint, they might be usefull. I do not know any specific others, but that one is indeed a really timesaving macro.


Offline
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 6:42 pm 

Joined: Fri Jan 04, 2008 2:11 pm
Posts: 72
Quote:
"I much rather create a class to handle tasks for me."


would u tell what functions the class should have ??

i was also thinking about making my own container with features from all others as vectors miss pop_front() , reverse() etc , lists miss some functions too , weird that my book lists them but my compiler doesn't list those functions......neways which is the best container for all purpose use??

for bidirectional push/pop, search , reverse , and accessible with iterators.


Offline
 Profile  
 
 Post subject:
PostPosted: Wed Jul 02, 2008 7:39 pm 
Site Admin

Joined: Sun Feb 11, 2007 8:59 am
Posts: 1094
Location: Ontario Canada
There is no such thing as a "best container" for general purpose use. There will always be a trade off between speed and flexibility.

If you want fast access O(1) then you should use std::vectors. If you want fast addition/removal then you should use std::list

Those are the two most common containers (that and std::maps if you want to quickly relate one value to another in a lookup table)


Offline
 Profile  
 
Display posts from previous:  Sort by  
 Page 1 of 1 [ 10 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

cron