From c2fb80288b83740eed207aa1c9865408ee50da61 Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 13 Dec 2013 08:30:32 +0000 Subject: [PATCH] Core: Tuple[n] now has Serialize git-svn-id: svn://ultimatepp.org/upp/trunk@6649 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Tuple.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/uppsrc/Core/Tuple.h b/uppsrc/Core/Tuple.h index f59067620..3e46de650 100644 --- a/uppsrc/Core/Tuple.h +++ b/uppsrc/Core/Tuple.h @@ -13,6 +13,8 @@ struct Tuple2 { bool operator>(const Tuple2& x) const { return Compare(x) > 0; } unsigned GetHashValue() const { return CombineHash(a, b); } + + void Serialize(Stream& s) { s % a % b; } String ToString() const { return String().Cat() << '(' << a << ", " << b << ')'; } }; @@ -49,6 +51,8 @@ struct Tuple3 { bool operator>(const Tuple3& x) const { return Compare(x) > 0; } unsigned GetHashValue() const { return CombineHash(a, b, c); } + + void Serialize(Stream& s) { s % a % b % c; } String ToString() const { return String().Cat() << '(' << a << ", " << b << ", " << c << ')'; } }; @@ -89,6 +93,8 @@ struct Tuple4 { unsigned GetHashValue() const { return CombineHash(a, b, c, d); } + void Serialize(Stream& s) { s % a % b % c % d; } + String ToString() const { return String().Cat() << '(' << a << ", " << b << ", " << c << ", " << d << ')'; } };