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/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