+ // Our insertion sort, guaranteed to be stable, as is needed
+ void insertion_sort(MoveStack* begin, MoveStack* end)
+ {
+ MoveStack tmp, *p, *q;
+
+ for (p = begin + 1; p < end; ++p)
+ {
+ tmp = *p;
+ for (q = p; q != begin && *(q-1) < tmp; --q)
+ *q = *(q-1);
+ *q = tmp;
+ }
+ }
+