From 97913b6fb268f327ee1a689779cb9b0621f72ff2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 29 Jul 2016 09:19:37 +0200 Subject: Fix duplicate config.build variable issue --- build2/config/module | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'build2/config/module') diff --git a/build2/config/module b/build2/config/module index 5becfd4..7360cf6 100644 --- a/build2/config/module +++ b/build2/config/module @@ -5,6 +5,8 @@ #ifndef BUILD2_CONFIG_MODULE #define BUILD2_CONFIG_MODULE +#include // find_if() + #include #include @@ -29,7 +31,21 @@ namespace build2 uint64_t flags; }; - using saved_variables = vector; + struct saved_variables: vector + { + // Normally each module only have a handful of config variables and we + // only do this during configuration so for now we do linear search + // instead of adding a map. + // + const_iterator + find (const variable& var) const + { + return std::find_if ( + begin (), + end (), + [&var] (const saved_variable& v) {return var == v.var;}); + } + }; struct saved_modules: butl::prefix_map { -- cgit v1.1