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/algorithm.cxx | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'build2/algorithm.cxx') diff --git a/build2/algorithm.cxx b/build2/algorithm.cxx index 588980e..e702836 100644 --- a/build2/algorithm.cxx +++ b/build2/algorithm.cxx @@ -720,8 +720,9 @@ namespace build2 match_prerequisite_range (a, t, group_prerequisite_members (a, t), s); } + template void - match_members (action a, target& t, const target* ts[], size_t n) + match_members (action a, target& t, T ts[], size_t n) { // Pretty much identical to match_prerequisite_range() except we don't // search. @@ -753,6 +754,15 @@ namespace build2 } } + // Instantiate only for what we need. + // + template void + match_members (action, target&, const target*[], size_t); + + template void + match_members ( + action, target&, prerequisite_target[], size_t); + const fsdir* inject_fsdir (action a, target& t, bool parent) { @@ -1027,10 +1037,9 @@ namespace build2 // but what the hell. Note that this means we have to always "harvest" all // the targets to clear the mark. // + template target_state - straight_execute_members (action a, - const target& t, - const target* ts[], size_t n) + straight_execute_members (action a, const target& t, T ts[], size_t n) { target_state r (target_state::unchanged); @@ -1082,10 +1091,9 @@ namespace build2 return r; } + template target_state - reverse_execute_members (action a, - const target& t, - const target* ts[], size_t n) + reverse_execute_members (action a, const target& t, T ts[], size_t n) { // Pretty much as straight_execute_members() but in reverse order. // @@ -1132,6 +1140,24 @@ namespace build2 return r; } + // Instantiate only for what we need. + // + template target_state + straight_execute_members ( + action, const target&, const target*[], size_t); + + template target_state + reverse_execute_members ( + action, const target&, const target*[], size_t); + + template target_state + straight_execute_members ( + action, const target&, prerequisite_target[], size_t); + + template target_state + reverse_execute_members ( + action, const target&, prerequisite_target[], size_t); + pair, const target*> execute_prerequisites (const target_type* tt, action a, const target& t, -- cgit v1.1