News for hackers. Stuff that matters.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by rumcajz on Thursday August 30, 2012 @12:49PM (#4455503)
Why not pass iterators? Consider the case where the object is contained in two lists. You would have to pass a pair of iterators. What if it is in 3 lists? Etc.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by icefox on Thursday August 30, 2012 @01:09PM (#4455621)
Agreed, but for the example the object only needs to live in one list (as shown by the fact that it could have been a C struct that contained the next/prev pointers) so passing iterator would have been sufficient and would have solved the O(n) problem(s?) he was having.
Re:Why should I have written ZeroMQ in C, not C++ (part II) by dkersten on Thursday August 30, 2012 @02:22PM (#4455998)
Exactly, the C example could not be contained in more than one list at a time, so if this is a concern, the C solution wouldn't work either.