diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-29 09:19:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-29 09:19:37 +0200 |
commit | 97913b6fb268f327ee1a689779cb9b0621f72ff2 (patch) | |
tree | dd130d9a3fc5a7b36bf2243eced97d4f4f7e6620 /build2/config/module | |
parent | 150bf0a18baab913c01fd1fa5f431455c35c99e1 (diff) |
Fix duplicate config.build variable issue
Diffstat (limited to 'build2/config/module')
-rw-r--r-- | build2/config/module | 18 |
1 files changed, 17 insertions, 1 deletions
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 <algorithm> // find_if() + #include <butl/prefix-map> #include <build2/types> @@ -29,7 +31,21 @@ namespace build2 uint64_t flags; }; - using saved_variables = vector<saved_variable>; + struct saved_variables: vector<saved_variable> + { + // 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<string, saved_variables, '.'> { |