From 2b43077d967c28fe99e1ff2b99f19e1433c710d9 Mon Sep 17 00:00:00 2001
From: houxiao <houxiao@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期四, 17 八月 2017 12:28:36 +0800
Subject: [PATCH] aaaaa
---
VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h
index 51b5dcf..3aa4ae2 100644
--- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h
+++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/array.h
@@ -177,6 +177,11 @@
inline T& front() { return *ptr; }
inline T& back() { return *(ptr + size_ - 1); }
+ template <typename U>
+ inline bool operator==(const U& other) const { return asPtr() == other; }
+ template <typename U>
+ inline bool operator!=(const U& other) const { return asPtr() != other; }
+
inline ArrayPtr<T> slice(size_t start, size_t end) {
KJ_IREQUIRE(start <= end && end <= size_, "Out-of-bounds Array::slice().");
return ArrayPtr<T>(ptr + start, end - start);
@@ -249,6 +254,8 @@
template <typename U>
friend class Array;
+ template <typename U>
+ friend class ArrayBuilder;
};
static_assert(!canMemcpy<Array<char>>(), "canMemcpy<>() is broken");
@@ -320,6 +327,13 @@
other.ptr = nullptr;
other.pos = nullptr;
other.endPtr = nullptr;
+ }
+ ArrayBuilder(Array<T>&& other)
+ : ptr(other.ptr), pos(other.ptr + other.size_), endPtr(pos), disposer(other.disposer) {
+ // Create an already-full ArrayBuilder from an Array of the same type. This constructor
+ // primarily exists to enable Vector<T> to be constructed from Array<T>.
+ other.ptr = nullptr;
+ other.size_ = 0;
}
KJ_DISALLOW_COPY(ArrayBuilder);
inline ~ArrayBuilder() noexcept(false) { dispose(); }
@@ -808,6 +822,15 @@
return heapArray<T>(init.begin(), init.end());
}
+#if __cplusplus > 201402L
+template <typename T, typename... Params>
+inline Array<Decay<T>> arr(T&& param1, Params&&... params) {
+ ArrayBuilder<Decay<T>> builder = heapArrayBuilder<Decay<T>>(sizeof...(params) + 1);
+ (builder.add(kj::fwd<T>(param1)), ... , builder.add(kj::fwd<Params>(params)));
+ return builder.finish();
+}
+#endif
+
} // namespace kj
#endif // KJ_ARRAY_H_
--
Gitblit v1.8.0