Add reference, pointer, and co type aliases for rtc::ArrayView.

Many STL containers define these type aliases, and they are easier to
work with than add_const_t<add_lvalue_reference_t<value_type>>.

In a followup, `WTF::Vector` in Blink's conversion constructor from
other containers will be SFINAE-guarded using these type aliases.

Bug: chromium:1408442
Change-Id: I7790e6f462a32e7e49bc6468afeda6b2e6d4b631
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/300180
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#39771}
This commit is contained in:
Daniel Cheng 2023-04-03 15:51:18 -07:00 committed by WebRTC LUCI CQ
parent deb25d2f45
commit 0e1d3c5675

View file

@ -149,6 +149,10 @@ template <typename T,
class ArrayView final : public array_view_internal::ArrayViewBase<T, Size> {
public:
using value_type = T;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = value_type*;
using const_pointer = const value_type*;
using const_iterator = const T*;
// Construct an ArrayView from a pointer and a length.