From 02aab60af4ebfadb0a51d44135c734d91430e11d Mon Sep 17 00:00:00 2001 From: pans <pans@454eff88-639b-444f-9e54-f578c98de674> Date: 星期三, 09 八月 2017 10:39:03 +0800 Subject: [PATCH] update capnproto include file --- VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h | 63 +++---------------------------- 1 files changed, 6 insertions(+), 57 deletions(-) diff --git a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h index cd765e5..4a908ae 100644 --- a/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h +++ b/VisitFace/RtspNativeCodec/app/libs/capnproto/include/kj/common.h @@ -455,10 +455,6 @@ // KJ_DECLTYPE_REF(i) i3(i); // i3 has type int&. // KJ_DECLTYPE_REF(kj::mv(i)) i4(kj::mv(i)); // i4 has type int. -template <typename T, typename U> struct IsSameType_ { static constexpr bool value = false; }; -template <typename T> struct IsSameType_<T, T> { static constexpr bool value = true; }; -template <typename T, typename U> constexpr bool isSameType() { return IsSameType_<T, U>::value; } - template <typename T> struct CanConvert_ { static int sfinae(T); @@ -915,6 +911,7 @@ return value; } +private: // internal interface used by friends only inline NullableValue() noexcept: isSet(false) {} inline NullableValue(T&& t) noexcept(noexcept(T(instance<T&&>()))) : isSet(true) { @@ -1092,32 +1089,18 @@ inline bool operator==(decltype(nullptr)) const { return ptr == nullptr; } inline bool operator!=(decltype(nullptr)) const { return ptr != nullptr; } - T& orDefault(T& defaultValue) & { + T& orDefault(T& defaultValue) { if (ptr == nullptr) { return defaultValue; } else { return *ptr; } } - const T& orDefault(const T& defaultValue) const & { + const T& orDefault(const T& defaultValue) const { if (ptr == nullptr) { return defaultValue; } else { return *ptr; - } - } - T&& orDefault(T&& defaultValue) && { - if (ptr == nullptr) { - return kj::mv(defaultValue); - } else { - return kj::mv(*ptr); - } - } - const T&& orDefault(const T&& defaultValue) const && { - if (ptr == nullptr) { - return kj::mv(defaultValue); - } else { - return kj::mv(*ptr); } } @@ -1180,7 +1163,7 @@ template <typename U> inline Maybe(Maybe<U&>& other) noexcept: ptr(other.ptr) {} template <typename U> - inline Maybe(const Maybe<U&>& other) noexcept: ptr(const_cast<const U*>(other.ptr)) {} + inline Maybe(const Maybe<const U&>& other) noexcept: ptr(other.ptr) {} inline Maybe(decltype(nullptr)) noexcept: ptr(nullptr) {} inline Maybe& operator=(T& other) noexcept { ptr = &other; return *this; } @@ -1247,31 +1230,8 @@ : ptr(init.begin()), size_(init.size()) {} template <size_t size> - inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) { - // Construct an ArrayPtr from a native C-style array. - // - // We disable this constructor for const char arrays because otherwise you would be able to - // implicitly convert a character literal to ArrayPtr<const char>, which sounds really great, - // except that the NUL terminator would be included, which probably isn't what you intended. - // - // TODO(someday): Maybe we should support character literals but explicitly chop off the NUL - // terminator. This could do the wrong thing if someone tries to construct an - // ArrayPtr<const char> from a non-NUL-terminated char array, but evidence suggests that all - // real use cases are in fact intending to remove the NUL terminator. It's convenient to be - // able to specify ArrayPtr<const char> as a parameter type and be able to accept strings - // as input in addition to arrays. Currently, you'll need overloading to support string - // literals in this case, but if you overload StringPtr, then you'll find that several - // conversions (e.g. from String and from a literal char array) become ambiguous! You end up - // having to overload for literal char arrays specifically which is cumbersome. - - static_assert(!isSameType<T, const char>(), - "Can't implicitly convert literal char array to ArrayPtr because we don't know if " - "you meant to include the NUL terminator. We may change this in the future to " - "automatically drop the NUL terminator. For now, try explicitly converting to StringPtr, " - "which can in turn implicitly convert to ArrayPtr<const char>."); - static_assert(!isSameType<T, const char16_t>(), "see above"); - static_assert(!isSameType<T, const char32_t>(), "see above"); - } + inline constexpr ArrayPtr(T (&native)[size]): ptr(native), size_(size) {} + // Construct an ArrayPtr from a native C-style array. inline operator ArrayPtr<const T>() const { return ArrayPtr<const T>(ptr, size_); @@ -1330,17 +1290,6 @@ return true; } inline bool operator!=(const ArrayPtr& other) const { return !(*this == other); } - - template <typename U> - inline bool operator==(const ArrayPtr<U>& other) const { - if (size_ != other.size()) return false; - for (size_t i = 0; i < size_; i++) { - if (ptr[i] != other[i]) return false; - } - return true; - } - template <typename U> - inline bool operator!=(const ArrayPtr<U>& other) const { return !(*this == other); } private: T* ptr; -- Gitblit v1.8.0