Efficient Programming with Components: Introduction Part 1
Why Stack Overflow recommends it
Stack Overflow users link it when discussing why to prefer arrays and vectors over node-based containers, how min and max should preserve stable ordering, and how to simulate concepts in C++ templates.
Recommended by 1 people across 1 different months, 2013 to 2016.
What it is
The first half of Alexander Stepanov's introduction to a course on Efficient Programming with Components, recorded at A9. He recounts his history with component programming, then shows an example of ineffective STL use and a much faster equivalent, using operation counting and timing.
What people said
Recommends A. K. · 2013-05 · Stack Overflow · on “Why is a set used instead of a map? C++”
correct. sets are particularly useful when the elements are smaller in size so inserting+sorting is fast. Also, using sets and maps are only good when the number of elements are small (small is relative here). You might find this lecture useful ( [this video] ) where Alex says try to use arrays/vectors as much as possible.
Cites dyp · 2014-05 · Stack Overflow · on “Implementing variadic min / max functions”
Stepanov argues that `min(a, b)` should return `a` iff `a <= b`, that is, `b < a ? b : a`. Has to do with "natural order" and is related to stability. Somewhere in this series: [this video]
Cites Drop · 2016-01 · Stack Overflow · on “#define as a workaround for missing concepts”
Is this a good idea for a library implementer to define macro while we are waiting for (hopefully) incoming concepts [LINK] ? What are advantages and disadvantages of this approach? Examples of macro (by A. Stepanov): #define TotallyOrdered typename #define Pointer typename #define Number typename #define Unsigned typename #define Integral typename #define InputIterator typename #define OutputIterator typename #define ForwardIterator typename #define BidirectionalIterator typename #define RandomAccessIterator typename ... Example usage (from me): template<ForwardIterator It> It min_element(It first, It last) { ... } The idea: while there are no concepts it's a plain old template code when co