diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 09:28:28 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-28 09:28:28 +0200 |
commit | e84eedc54348e268ca95200b70caede9884076ea (patch) | |
tree | 47adec094b24d8cb6934bbf28434e746ad9f564f /build2/target.hxx | |
parent | 566bcb8c4c36d12e398f00349c5f27cae06fa7a9 (diff) |
Add support for custom data storage in target::preprequisite_targets
Diffstat (limited to 'build2/target.hxx')
-rw-r--r-- | build2/target.hxx | 23 |
1 files changed, 21 insertions, 2 deletions
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<const target*> (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<prerequisite_target>; + // Target. // class target @@ -552,8 +572,7 @@ namespace build2 // // Note that the recipe may modify this list. // - using prerequisite_targets_type = vector<const target*>; - mutable prerequisite_targets_type prerequisite_targets; + mutable build2::prerequisite_targets prerequisite_targets; // Auxilary data storage. // |