summaryrefslogtreecommitdiff
path: root/wx+/grid.h
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-10-17 02:11:26 +0000
committerB Stack <bgstack15@gmail.com>2018-10-17 02:11:26 +0000
commitf70f8f961ef8f4d909266f71310e3515f25928e6 (patch)
tree89b2a018482c164bdd8ecac5c76b19a08f420dec /wx+/grid.h
parentMerge branch '10.4' into 'master' (diff)
parent10.5 (diff)
downloadFreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.tar.gz
FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.tar.bz2
FreeFileSync-f70f8f961ef8f4d909266f71310e3515f25928e6.zip
Merge branch '10.5' into 'master'10.5
10.5 See merge request opensource-tracking/FreeFileSync!2
Diffstat (limited to 'wx+/grid.h')
-rwxr-xr-xwx+/grid.h20
1 files changed, 15 insertions, 5 deletions
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 <memory>
#include <numeric>
+#include <optional>
+#include <set>
#include <vector>
-#include <wx/scrolwin.h>
#include <zen/basic_math.h>
+#include <wx/scrolwin.h>
//a user-friendly, extensible and high-performance grid control
@@ -362,10 +364,18 @@ private:
template <class ColAttrReal>
std::vector<ColAttrReal> makeConsistent(const std::vector<ColAttrReal>& attribs, const std::vector<ColAttrReal>& defaults)
{
- std::vector<ColAttrReal> 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<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!
+
return output;
}
bgstack15