summaryrefslogtreecommitdiff
path: root/cpp/include/Ice/OutputStream.h
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2016-07-11 09:17:55 -0400
committerJoe George <joe@zeroc.com>2016-07-11 09:25:01 -0400
commitef64ff67e60bf1e64d15608b96fcb4591add2426 (patch)
tree71d77ee61490e0fb213128468a910d6303b5645e /cpp/include/Ice/OutputStream.h
parentUpdate to use latest Gradle Ice builder version (diff)
downloadice-ef64ff67e60bf1e64d15608b96fcb4591add2426.tar.bz2
ice-ef64ff67e60bf1e64d15608b96fcb4591add2426.tar.xz
ice-ef64ff67e60bf1e64d15608b96fcb4591add2426.zip
StreamReader/Writer improvements
- No longer generate StreamWriter partial template specialization for C++ classes/structs/exceptions which have no optional members. - Reduce generated code size for all C++11 StreamReader/Writers.
Diffstat (limited to 'cpp/include/Ice/OutputStream.h')
-rw-r--r--cpp/include/Ice/OutputStream.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h
index cf90475ceec..67994253814 100644
--- a/cpp/include/Ice/OutputStream.h
+++ b/cpp/include/Ice/OutputStream.h
@@ -312,6 +312,21 @@ public:
writeAll(ve...);
}
+ template<size_t I = 0, typename... Te>
+ typename std::enable_if<I == sizeof...(Te), void>::type
+ writeAll(std::tuple<Te...> tuple)
+ {
+ // Do nothing. Either tuple is empty or we are at the end.
+ }
+
+ template<size_t I = 0, typename... Te>
+ typename std::enable_if<I < sizeof...(Te), void>::type
+ writeAll(std::tuple<Te...> tuple)
+ {
+ write(std::get<I>(tuple));
+ writeAll<I + 1, Te...>(tuple);
+ }
+
template<typename T>
void writeAll(std::initializer_list<int> tags, const IceUtil::Optional<T>& v)
{