From 96d406960dce412297e331d977060751f7149d4a Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Wed, 9 Mar 2011 12:45:45 -0500 Subject: [PATCH] Enhancement - Corrected sorting to use std::stable_sort instead of std::sort, which is not guaranteed stable (thanks to Stefan Hacker). --- AUTHORS | 1 + ChangeLog | 2 ++ src/Table.cpp | 2 +- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 4ed2fe7ea..633581063 100644 --- a/AUTHORS +++ b/AUTHORS @@ -79,4 +79,5 @@ suggestions: Patrick R McDonald Pete Lewis Bryce Harrington + Stefan Hacker diff --git a/ChangeLog b/ChangeLog index a026f62eb..e24b05a90 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ 2.0.0 () + autoconf eliminated. + + Corrected sorting to use std::stable_sort instead of std::sort, which is not + guaranteed stable (thanks to Stefan Hacker). ------ old releases ------------------------------ diff --git a/src/Table.cpp b/src/Table.cpp index a9a90fa1b..8bd464cb8 100644 --- a/src/Table.cpp +++ b/src/Table.cpp @@ -829,7 +829,7 @@ const std::string Table::render (int maxrows /* = 0 */, int maxlines /* = 0 */) if (mSortColumns.size ()) { table = this; // Substitute for 'this' in the static 'sort_compare'. - std::sort (order.begin (), order.end (), sort_compare); + std::stable_sort (order.begin (), order.end (), sort_compare); } }