diff options
author | B Stack <bgstack15@gmail.com> | 2018-10-17 02:11:26 +0000 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2018-10-17 02:11:26 +0000 |
commit | f70f8f961ef8f4d909266f71310e3515f25928e6 (patch) | |
tree | 89b2a018482c164bdd8ecac5c76b19a08f420dec /wx+/grid.h | |
parent | Merge branch '10.4' into 'master' (diff) | |
parent | 10.5 (diff) | |
download | FreeFileSync-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-x | wx+/grid.h | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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; } |