Click here to Skip to main content
16,011,374 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
QuestionSTL Algorithms Pin
Zac Howland12-Sep-06 11:11
Zac Howland12-Sep-06 11:11 
AnswerRe: STL Algorithms Pin
Christian Graus12-Sep-06 11:41
protectorChristian Graus12-Sep-06 11:41 
GeneralRe: STL Algorithms Pin
Stuart Dootson12-Sep-06 14:19
professionalStuart Dootson12-Sep-06 14:19 
GeneralRe: STL Algorithms Pin
Zac Howland12-Sep-06 16:59
Zac Howland12-Sep-06 16:59 
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 
Michael Dunn wrote:
The VC 6 STL docs blow so I haven't read them much and don't know what algorithm functions exist


See, this kind of comment is the kind that surprises me. My undergraduate textbook for my Data Structures and Algorithms class went over all that very well ... and Bjarne's book covers them fairly well, also. Seems to me those would be required reading for any C++ programmer (just like Petzold and Prosise are generally considered to be required reading for doing Windows programming in C++).

Michael Dunn wrote:
The STL naming scheme sucks so it's hard to figure out what some functions are for from just their name (and the docs aren't much help, see 1. I mean, seriously, WTF does "bind2nd" do??)


It does exactly what it says it does: binds the second argument to what you pass in to bind2nd. Namely, when passing a binary function/functor into an algorithm that is expecting a unary function/functor, it allows you to bind the second value of the function call to something outside the algorithm. The syntax is a bit tough to get the hang of at first, but it makes sense once you get use to it.


Michael Dunn wrote:
Most of the time when I do use algorithms, it involves writing a special-case functor for just that usage, which is workable but just feels sloppy. I know about mem_fun_ref and the like, but I haven't taken the time to figure out how they work.


There are some things where functors are useful (a general case Deleter functor, for example), but most of the time, I just write a simple function that isn't a member function to do whatever operation I was intending to do in the loop, and then use for_each or transform. It doesn't have to be a functor to be passed into an algorithm.

Michael Dunn wrote:
Instead of fighting with the docs, I'll just write a for loop and be done with it


So, what you are saying is that you basically ignore principles of good software engineering practices with regard to code reuse because you are too lazy to learn to use the standard library's power?

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
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 
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 

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.