aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/action.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-22 14:38:57 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-23 18:14:07 +0200
commit5035f4ef68922ac758b1e4734e67d73c9228010b (patch)
tree271fdd5b1d6e995a058d97aacb3ac90a538d9ff1 /libbuild2/action.hxx
parent8793941652d6aa1c3d02b2f87f691e6d06254b7d (diff)
Introduce notion of build context
All non-const global state is now in class context and we can now have multiple independent builds going on at the same time.
Diffstat (limited to 'libbuild2/action.hxx')
-rw-r--r--libbuild2/action.hxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/libbuild2/action.hxx b/libbuild2/action.hxx
index 9fa2a16..01c5307 100644
--- a/libbuild2/action.hxx
+++ b/libbuild2/action.hxx
@@ -116,10 +116,18 @@ namespace build2
template <typename T>
struct action_state
{
- T data[2]; // [0] -- inner, [1] -- outer.
+ T inner;
+ T outer;
- T& operator[] (action a) {return data[a.inner () ? 0 : 1];}
- const T& operator[] (action a) const {return data[a.inner () ? 0 : 1];}
+ T& operator[] (action a) {return a.inner () ? inner : outer;}
+ const T& operator[] (action a) const {return a.inner () ? inner : outer;}
+
+ action_state () = default;
+
+ template <typename... A>
+ explicit
+ action_state (A&&... a)
+ : inner (forward<A> (a)...), outer (forward<A> (a)...) {}
};
// Id constants for build-in and pre-defined meta/operations.