Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1168)

Unified Diff: webrtc/api/array_view.h

Issue 3007763002: Move array_view.h to webrtc/api/ (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/api/array_view.h
diff --git a/webrtc/rtc_base/array_view.h b/webrtc/api/array_view.h
similarity index 94%
copy from webrtc/rtc_base/array_view.h
copy to webrtc/api/array_view.h
index afc69995ae8d9cbc1cd72a56c28a78326549d964..651cfe83379011a58a1ea5ba8a6bc24d0a75aa23 100644
--- a/webrtc/rtc_base/array_view.h
+++ b/webrtc/api/array_view.h
@@ -8,8 +8,10 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#ifndef WEBRTC_RTC_BASE_ARRAY_VIEW_H_
-#define WEBRTC_RTC_BASE_ARRAY_VIEW_H_
+#ifndef WEBRTC_API_ARRAY_VIEW_H_
+#define WEBRTC_API_ARRAY_VIEW_H_
+
+#include <algorithm>
#include "webrtc/rtc_base/checks.h"
#include "webrtc/rtc_base/type_traits.h"
nisse-webrtc 2017/09/01 07:07:44 In a different cl, you preferred <type_traits>. Bu
kwiberg-webrtc 2017/09/01 08:45:31 Yes. rtc_base/type_traits.h currently defines just
@@ -155,7 +157,8 @@ class ArrayView final : public impl::ArrayViewBase<T, Size> {
// Construct an empty ArrayView. Note that fixed-size ArrayViews of size > 0
// cannot be empty.
ArrayView() : ArrayView(nullptr, 0) {}
- ArrayView(std::nullptr_t) : ArrayView() {}
+ ArrayView(std::nullptr_t) // NOLINT
+ : ArrayView() {}
ArrayView(std::nullptr_t, size_t size)
: ArrayView(static_cast<T*>(nullptr), size) {
static_assert(Size == 0 || Size == impl::kArrayViewVarSize, "");
@@ -164,7 +167,8 @@ class ArrayView final : public impl::ArrayViewBase<T, Size> {
// Construct an ArrayView from an array.
template <typename U, size_t N>
- ArrayView(U (&array)[N]) : ArrayView(array, N) {
+ ArrayView(U (&array)[N]) // NOLINT
+ : ArrayView(array, N) {
static_assert(Size == N || Size == impl::kArrayViewVarSize,
"Array size must match ArrayView size");
}
@@ -176,11 +180,12 @@ class ArrayView final : public impl::ArrayViewBase<T, Size> {
// N>, but not the other way around. We also don't allow conversion from
// ArrayView<T> to ArrayView<T, N>, or from ArrayView<T, M> to ArrayView<T,
// N> when M != N.
- template <typename U,
- typename std::enable_if<
- Size != impl::kArrayViewVarSize &&
- HasDataAndSize<U, T>::value>::type* = nullptr>
- ArrayView(U& u) : ArrayView(u.data(), u.size()) {
+ template <
+ typename U,
+ typename std::enable_if<Size != impl::kArrayViewVarSize &&
+ HasDataAndSize<U, T>::value>::type* = nullptr>
+ ArrayView(U& u) // NOLINT
+ : ArrayView(u.data(), u.size()) {
static_assert(U::size() == Size, "Sizes must match exactly");
}
@@ -199,7 +204,8 @@ class ArrayView final : public impl::ArrayViewBase<T, Size> {
typename U,
typename std::enable_if<Size == impl::kArrayViewVarSize &&
HasDataAndSize<U, T>::value>::type* = nullptr>
- ArrayView(U& u) : ArrayView(u.data(), u.size()) {}
+ ArrayView(U& u) // NOLINT
+ : ArrayView(u.data(), u.size()) {}
// Indexing and iteration. These allow mutation even if the ArrayView is
// const, because the ArrayView doesn't own the array. (To prevent mutation,
@@ -250,4 +256,4 @@ inline ArrayView<T> MakeArrayView(T* data, size_t size) {
} // namespace rtc
-#endif // WEBRTC_RTC_BASE_ARRAY_VIEW_H_
+#endif // WEBRTC_API_ARRAY_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698