From ffe697539112bca297d7af73f8a02f9c83a38d58 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 20 Sep 2018 20:52:41 +0800 Subject: [PATCH] 1 --- cpp/utils.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/utils.h b/cpp/utils.h index 75ba6ca..1cba8ef 100644 --- a/cpp/utils.h +++ b/cpp/utils.h @@ -31,6 +31,7 @@ template static void RepeatedFieldToVector(const T1& t1, T2& t2) { + t2.clear(); for (auto& val : t1) { t2.push_back(val); } @@ -40,6 +41,7 @@ template static void RepeatedFieldToSet(const T1& t1, T2& t2) { + t2.clear(); for (auto& val : t1) { t2.insert(val); } @@ -49,6 +51,7 @@ template static void VectorToRepeatedField(const T1& t1, T2& t2) { + t2.Clear(); for (auto& val : t1) { *t2.Add() = val; } @@ -58,6 +61,7 @@ template static void SetToRepeatedField(const T1& t1, T2& t2) { + t2.Clear(); for (auto& val : t1) { *t2.Add() = val; }