Upstream commit: https://webrtc.googlesource.com/src/+/ab26421b75e24a0ac49c6bb8794b4b5eebdb88b3 Deprecate ArrayView alias To prevent new usages in WebRTC and trigger clang inliner bots to update downstream projects to use std::span directly This is a reland of these two changes combined: https://webrtc-review.googlesource.com/c/src/+/461500 https://webrtc-review.googlesource.com/c/src/+/461840 Bug: webrtc:439801349 Change-Id: Id1d272a0d606aff4eed27c43d7a2c2b1fcab1e37 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/462021 Reviewed-by: Evan Shrubsole <eshr@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#47631}
36 lines
987 B
C++
36 lines
987 B
C++
/*
|
|
* Copyright 2015 The WebRTC Project Authors. All rights reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef API_ARRAY_VIEW_H_
|
|
#define API_ARRAY_VIEW_H_
|
|
|
|
#include <cstddef>
|
|
#include <span>
|
|
|
|
#include "absl/base/macros.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// A parameter pack of extents is used to ensure that ArrayView<T> inlines to
|
|
// span<T>, but only 0 or 1 extent is supported.
|
|
template <typename T, size_t... extent>
|
|
using ArrayView ABSL_DEPRECATE_AND_INLINE() = std::span<T, extent...>;
|
|
|
|
template <typename T>
|
|
ABSL_DEPRECATE_AND_INLINE()
|
|
inline std::span<T> MakeArrayView(T* data, size_t size) {
|
|
return std::span(data, size);
|
|
}
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
#endif // API_ARRAY_VIEW_H_
|