diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-23 09:55:28 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-23 09:55:28 +0200 |
commit | 5badf4672d3c647465e1764006440beb5c5109d8 (patch) | |
tree | 1b8b70100b94c07a0b7208d0ac0dc93361bac10d | |
parent | 421d0a4d1a7786e90407072b378cc060d325907d (diff) |
MSVC fix
-rw-r--r-- | libbuild2/action.hxx | 14 | ||||
-rw-r--r-- | libbuild2/target.cxx | 4 | ||||
-rw-r--r-- | libbuild2/target.hxx | 2 |
3 files changed, 14 insertions, 6 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. diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx index 9d81dee..dbca6cd 100644 --- a/libbuild2/target.cxx +++ b/libbuild2/target.cxx @@ -418,8 +418,8 @@ namespace build2 { t->ext_ = &i->first.ext; t->implied = implied; - t->state.data[0].target_ = t; - t->state.data[1].target_ = t; + t->state.inner.target_ = t; + t->state.outer.target_ = t; return pair<target&, ulock> (*t, move (ul)); } diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx index f140122..f1c9d5f 100644 --- a/libbuild2/target.hxx +++ b/libbuild2/target.hxx @@ -775,7 +775,7 @@ namespace build2 : ctx (c), dir (move (d)), out (move (o)), name (move (n)), vars (c, false /* global */), - state {opstate (c), opstate (c)} {} + state (c) {} target (target&&) = delete; target& operator= (target&&) = delete; |