From 1ec5ff7b1443e4b205b953875fd876fd6e76fce0 Mon Sep 17 00:00:00 2001
From: pans <pans@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期三, 09 八月 2017 12:22:33 +0800
Subject: [PATCH] capnproto update to 7.0dev

---
 VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h
index 6e143c4..7b3f965 100644
--- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h
+++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/one-of.h
@@ -81,6 +81,21 @@
     return *reinterpret_cast<T*>(space);
   }
 
+  template <typename T>
+  Maybe<T&> tryGet() {
+    if (is<T>()) {
+      return *reinterpret_cast<T*>(space);
+    } else {
+      return nullptr;
+    }
+  }
+
+  template <uint i>
+  KJ_NORETURN(void allHandled());
+  // After a series of if/else blocks handling each variant of the OneOf, have the final else
+  // block call allHandled<n>() where n is the number of variants. This will fail to compile
+  // if new variants are added in the future.
+
 private:
   uint tag;
 
@@ -150,6 +165,17 @@
   }
 };
 
+template <typename... Variants>
+template <uint i>
+void OneOf<Variants...>::allHandled() {
+  // After a series of if/else blocks handling each variant of the OneOf, have the final else
+  // block call allHandled<n>() where n is the number of variants. This will fail to compile
+  // if new variants are added in the future.
+
+  static_assert(i == sizeof...(Variants), "new OneOf variants need to be handled here");
+  KJ_UNREACHABLE;
+}
+
 }  // namespace kj
 
 #endif  // KJ_ONE_OF_H_

--
Gitblit v1.8.0