From 878a41d3be13da2a654df74f2a35ea8b295c8a13 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 16 Oct 2018 17:33:51 -0400 Subject: 10.5 --- wx+/grid.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'wx+/grid.h') diff --git a/wx+/grid.h b/wx+/grid.h index 732a4fcb..ccf7ad64 100755 --- a/wx+/grid.h +++ b/wx+/grid.h @@ -9,9 +9,11 @@ #include #include +#include +#include #include -#include #include +#include //a user-friendly, extensible and high-performance grid control @@ -362,10 +364,18 @@ private: template std::vector makeConsistent(const std::vector& attribs, const std::vector& defaults) { - std::vector output = attribs; - //make sure each type is existing! - output.insert(output.end(), defaults.begin(), defaults.end()); - removeDuplicates(output, [](const ColAttrReal& lhs, const ColAttrReal& rhs) { return lhs.type < rhs.type; }); + using ColTypeReal = decltype(ColAttrReal().type); + std::vector output; + + std::set usedTypes; //remove duplicates + auto appendUnique = [&](const std::vector& 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! + return output; } -- cgit