[base] Add IsContiguousIterator type trait
This change implements the base::IsContiguousIterator type trait and makes use of it in base::span's constructor to allow construction from arbitrary contiguous iterators, and not just pointers. Given the lack of std::contiguous_iterator_tag in C++14, the type trait is especially instantiated for iterators that are known to be contiguous. These include pointers, and the iterators for std::array, std::string and std::vector<T> (for T != bool). Lastly, this change adds an implementation of std::to_address, which allows obtaining the underlying address from a pointer like type. TBR=dcheng Bug: 828324 Change-Id: I00d44c5edf8d86f811b7b2d32f07fa15e084d987 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2093215 Commit-Queue: Jan Wilken Dörrie <jdoerrie@chromium.org> Reviewed-by:Daniel Cheng <dcheng@chromium.org> Cr-Commit-Position: refs/heads/master@{#816543}
Showing
This diff is collapsed.
Please register or sign in to comment