From 1397444e5de3281431d2174564dfd76fe7b7b32f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Apr 2016 07:19:03 +0200 Subject: Use hash map/set for targets/prerequisites to resolve key change issue --- build2/target | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'build2/target') diff --git a/build2/target b/build2/target index 9061e2d..ac67ff8 100644 --- a/build2/target +++ b/build2/target @@ -5,9 +5,9 @@ #ifndef BUILD2_TARGET #define BUILD2_TARGET -#include #include // tags, etc. #include +#include #include // map_iterator_adapter @@ -779,13 +779,18 @@ namespace build2 a, reverse_iterate (group_prerequisites (t)), members); } - // + // A target with an unspecified extension is considered equal to the one + // with the specified one. And when we find a target with an unspecified + // extension via a key with the specified one, we update the extension, + // essentially modifying the map's key. To make this work we use a hash + // map. The key's hash ignores the extension, so the hash will stay stable + // across extension updates. // struct target_set { - // @@ When we update ext in key, don't we change it? I think we do. + // @@ Why do we dynalloc target? // - typedef std::map> map; + typedef std::unordered_map> map; typedef butl::map_iterator_adapter iterator; iterator -- cgit v1.1