mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core:: Tuple::Set
git-svn-id: svn://ultimatepp.org/upp/trunk@8256 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9394983a79
commit
580d994707
1 changed files with 17 additions and 0 deletions
|
|
@ -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 <typename AA, typename BB>
|
||||
operator Tuple2<AA, BB>() const { Tuple2<AA, BB> 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 <typename AA, typename BB, typename CC>
|
||||
operator Tuple3<AA, BB, CC>() const { Tuple3<AA, BB, CC> 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 <typename AA, typename BB, typename CC, typename DD>
|
||||
operator Tuple4<AA, BB, CC, DD>() const { Tuple4<AA, BB, CC, DD> t; t.a = (AA)a; t.b = (BB)b; t.c = (CC)c; t.d = (DD)d; return t; }
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue