From e84eedc54348e268ca95200b70caede9884076ea Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 28 Jul 2017 09:28:28 +0200 Subject: Add support for custom data storage in target::preprequisite_targets --- build2/target.hxx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'build2/target.hxx') diff --git a/build2/target.hxx b/build2/target.hxx index b5863dc..92c5768 100644 --- a/build2/target.hxx +++ b/build2/target.hxx @@ -115,6 +115,26 @@ namespace build2 size_t count; }; + // List of prerequisites resolved to targets. Unless additional storage is + // needed, it can be used as just vector (which is what we + // used to have initially). + // + struct prerequisite_target + { + using target_type = build2::target; + + prerequisite_target (const target_type* t, uintptr_t d = 0) + : target (t), data (d) {} + + operator const target_type*& () {return target;} + operator const target_type* () const {return target;} + const target_type* operator-> () const {return target;} + + const target_type* target; + uintptr_t data; + }; + using prerequisite_targets = vector; + // Target. // class target @@ -552,8 +572,7 @@ namespace build2 // // Note that the recipe may modify this list. // - using prerequisite_targets_type = vector; - mutable prerequisite_targets_type prerequisite_targets; + mutable build2::prerequisite_targets prerequisite_targets; // Auxilary data storage. // -- cgit v1.1