Click here to Skip to main content
15,891,316 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: STL Algorithms Pin
Michael Dunn12-Sep-06 20:21
sitebuilderMichael Dunn12-Sep-06 20:21 
GeneralRe: STL Algorithms Pin
Stephen Hewitt12-Sep-06 22:08
Stephen Hewitt12-Sep-06 22:08 
GeneralRe: STL Algorithms Pin
Stuart Dootson12-Sep-06 22:17
professionalStuart Dootson12-Sep-06 22:17 
GeneralRe: STL Algorithms Pin
Zac Howland13-Sep-06 3:15
Zac Howland13-Sep-06 3:15 
GeneralRe: STL Algorithms Pin
Kevin McFarlane13-Sep-06 4:11
Kevin McFarlane13-Sep-06 4:11 
AnswerRe: STL Algorithms Pin
Steve Echols12-Sep-06 21:29
Steve Echols12-Sep-06 21:29 
GeneralRe: STL Algorithms Pin
Stephen Hewitt12-Sep-06 22:27
Stephen Hewitt12-Sep-06 22:27 
GeneralRe: STL Algorithms Pin
Zac Howland13-Sep-06 3:24
Zac Howland13-Sep-06 3:24 
Stephen Hewitt wrote:
typedef std::vector<whatever> collection_t;

collection_t coll;
// Fill 'coll' here...
for (collection_t::iterator i=vec.begin(); i!=vec.end(); ++i)
{
// Do stuff here...
}


That still doesn't use STL's algorithms. Granted, it is reimplementing a for_each or a transform (depending on what you do in the loop), but the fact is it is still reimplementing it needlessly.


Stephen Hewitt wrote:
This is an expression of the general design principle that one design decision should be expressed in only one place, if possible. In this case the choice of collection type only requires a change in one location and not scattered places throughout the code. STL and iterators don't make this happen automatically but they provide the abstractions to make this sort of thing possible.


Take a look at Scott Meyer's "Effective STL" for why this isn't really true.

If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

GeneralRe: STL Algorithms Pin
Stephen Hewitt13-Sep-06 14:14
Stephen Hewitt13-Sep-06 14:14 
GeneralRe: STL Algorithms Pin
Zac Howland13-Sep-06 18:32
Zac Howland13-Sep-06 18:32 
GeneralRe: STL Algorithms [modified] Pin
Stephen Hewitt13-Sep-06 19:32
Stephen Hewitt13-Sep-06 19:32 
GeneralRe: STL Algorithms Pin
Zac Howland14-Sep-06 3:13
Zac Howland14-Sep-06 3:13 
GeneralRe: STL Algorithms Pin
Stephen Hewitt14-Sep-06 13:50
Stephen Hewitt14-Sep-06 13:50 
GeneralRe: STL Algorithms Pin
Zac Howland14-Sep-06 19:17
Zac Howland14-Sep-06 19:17 
GeneralRe: STL Algorithms Pin
Stephen Hewitt14-Sep-06 19:27
Stephen Hewitt14-Sep-06 19:27 
GeneralRe: STL Algorithms Pin
Zac Howland13-Sep-06 3:21
Zac Howland13-Sep-06 3:21 
AnswerRe: STL Algorithms Pin
Kevin McFarlane13-Sep-06 4:08
Kevin McFarlane13-Sep-06 4:08 
GeneralRe: STL Algorithms Pin
Zac Howland13-Sep-06 4:23
Zac Howland13-Sep-06 4:23 
GeneralRe: STL Algorithms Pin
Kevin McFarlane13-Sep-06 9:01
Kevin McFarlane13-Sep-06 9:01 
GeneralRe: STL Algorithms Pin
Zac Howland13-Sep-06 9:17
Zac Howland13-Sep-06 9:17 
AnswerRe: STL Algorithms Pin
Stephen Hewitt13-Sep-06 22:52
Stephen Hewitt13-Sep-06 22:52 
GeneralRe: STL Algorithms Pin
Rob Caldecott13-Sep-06 23:40
Rob Caldecott13-Sep-06 23:40 
GeneralRe: STL Algorithms Pin
Stuart Dootson14-Sep-06 1:17
professionalStuart Dootson14-Sep-06 1:17 
GeneralRe: STL Algorithms Pin
Zac Howland14-Sep-06 3:17
Zac Howland14-Sep-06 3:17 
GeneralRe: STL Algorithms Pin
Nemanja Trifunovic15-Sep-06 4:43
Nemanja Trifunovic15-Sep-06 4:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.