Constructor test: a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 a1 STL fill() test: b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 b1 STL generate() test: a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 STL random_shuffle() test: a3 e1 c2 c3 e4 c1 a4 e2 d3 a1 a2 e3 b3 b2 b1 c4 d1 d4 b4 d2 STL sort() test (ascending order by column No) : a3 a4 a1 a2 b3 b2 b1 b4 c2 c3 c1 c4 d3 d1 d4 d2 e4 e1 e2 e3 STL sort() test (descending order by column No) : e4 e1 e2 e3 d3 d1 d4 d2 c2 c3 c1 c4 b3 b2 b1 b4 a3 a4 a1 a2 STL sort() test (ascending order by column and row No): Guess why sort order by column No is broken? a1 b1 c1 d1 e1 b2 c2 a2 d2 e2 b3 d3 a3 c3 e3 a4 c4 b4 e4 d4 STL stable sort() test (ascending order by column and row No) : a1 b1 c1 d1 e1 a2 b2 c2 d2 e2 a3 b3 c3 d3 e3 a4 b4 c4 d4 e4 STL sort() using binary predicate less<> to the entire pair (ascending order by column and row No) : a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 e1 e2 e3 e4 Let's add duplicate items (a2, c2, d3): a1 a2 c2 d3 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 e1 e2 e3 e4 Sort container before applying unique: a1 a2 a2 a3 a4 b1 b2 b3 b4 c1 c2 c2 c3 c4 d1 d2 d3 d3 d4 e1 e2 e3 e4 Result of STL unique: No items have been erased !!! Items to be deleted will be located starting from "toBeDeleted" iterator position. Items whose index is in range from 20 to 22 are garbage. a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 e1 e2 e3 e4 e2 e3 e4 Duplicate items have been erased: a1 a2 a3 a4 b1 b2 b3 b4 c1 c2 c3 c4 d1 d2 d3 d4 e1 e2 e3 e4