diff --git a/uppsrc/Core/Tuple.h b/uppsrc/Core/Tuple.h index 2c664fecc..f2c478c6d 100644 --- a/uppsrc/Core/Tuple.h +++ b/uppsrc/Core/Tuple.h @@ -18,6 +18,10 @@ struct Tuple2 { String ToString() const { return String().Cat() << '(' << a << ", " << b << ')'; } + Tuple2& SetA(const A& a_) { a = a_; return *this; } + Tuple2& SetB(const B& b_) { b = b_; return *this; } + Tuple2& Set(const A& a_, const B& b_) { a = a_; b = b_; return *this; } + template operator Tuple2() const { Tuple2 t; t.a = (AA)a; t.b = (BB)b; return t; } }; @@ -65,6 +69,12 @@ struct Tuple3 { String ToString() const { return String().Cat() << '(' << a << ", " << b << ", " << c << ')'; } + Tuple3& SetA(const A& a_) { a = a_; return *this; } + Tuple3& SetB(const B& b_) { b = b_; return *this; } + Tuple3& SetC(const C& c_) { c = c_; return *this; } + Tuple3& Set(const A& a_, const B& b_, const C& c_) + { a = a_; b = b_; c = c_; return *this; } + template operator Tuple3() const { Tuple3 t; t.a = (AA)a; t.b = (BB)b; t.c = (CC)c; return t; } }; @@ -115,6 +125,13 @@ struct Tuple4 { String ToString() const { return String().Cat() << '(' << a << ", " << b << ", " << c << ", " << d << ')'; } + Tuple4& SetA(const A& a_) { a = a_; return *this; } + Tuple4& SetB(const B& b_) { b = b_; return *this; } + Tuple4& SetC(const C& c_) { c = c_; return *this; } + Tuple4& SetD(const D& c_) { d = d_; return *this; } + Tuple4& Set(const A& a_, const B& b_, const C& c_, const D& d_) + { a = a_; b = b_; c = c_; d = d_; return *this; } + template operator Tuple4() const { Tuple4 t; t.a = (AA)a; t.b = (BB)b; t.c = (CC)c; t.d = (DD)d; return t; } };