summaryrefslogtreecommitdiff
path: root/wx+/grid.h
diff options
context:
space:
mode:
Diffstat (limited to 'wx+/grid.h')
-rw-r--r--wx+/grid.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/wx+/grid.h b/wx+/grid.h
index 4de76b66..8ab03932 100644
--- a/wx+/grid.h
+++ b/wx+/grid.h
@@ -12,6 +12,7 @@
#include <optional>
#include <set>
#include <vector>
+#include <zen/stl_tools.h>
//#include <zen/basic_math.h>
#include <wx/scrolwin.h>
@@ -366,18 +367,9 @@ private:
template <class ColAttrReal>
std::vector<ColAttrReal> makeConsistent(const std::vector<ColAttrReal>& attribs, const std::vector<ColAttrReal>& defaults)
{
- using ColTypeReal = decltype(ColAttrReal().type);
- std::vector<ColAttrReal> output;
-
- std::set<ColTypeReal> usedTypes; //remove duplicates
- auto appendUnique = [&](const std::vector<ColAttrReal>& attr)
- {
- std::copy_if(attr.begin(), attr.end(), std::back_inserter(output),
- [&](const ColAttrReal& a) { return usedTypes.insert(a.type).second; });
- };
- appendUnique(attribs);
- appendUnique(defaults); //make sure each type is existing!
-
+ std::vector<ColAttrReal> output = attribs;
+ append(output, defaults); //make sure each type is existing!
+ removeDuplicatesStable(output, [](const ColAttrReal& lhs, const ColAttrReal& rhs) { return lhs.type < rhs.type; });
return output;
}
bgstack15