Style guide: Add guideline for ArrayView
BUG=none NOTRY=true Change-Id: I25ac7da349246f6bf1441200f2a2136218e30591 Reviewed-on: https://chromium-review.googlesource.com/648982 Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Niels Möller <nisse@chromium.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#19711}
This commit is contained in:
@ -3,9 +3,9 @@
|
||||
## C++
|
||||
|
||||
WebRTC follows the [Chromium][chr-style] and [Google][goog-style] C++
|
||||
style guides, unless an exception is listed below. In cases where they
|
||||
conflict, the Chromium style guide trumps the Google style guide, and
|
||||
the exceptions in this file trump them both.
|
||||
style guides. In cases where they conflict, the Chromium style guide
|
||||
trumps the Google style guide, and the rules in this file trump them
|
||||
both.
|
||||
|
||||
[chr-style]: https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md
|
||||
[goog-style]: https://google.github.io/styleguide/cppguide.html
|
||||
@ -18,10 +18,21 @@ Some older parts of the code violate the style guide in various ways.
|
||||
* If making large changes to such code, consider first cleaning it up
|
||||
in a separate CL.
|
||||
|
||||
### Exceptions
|
||||
### ArrayView
|
||||
|
||||
There are no exceptions yet. If and when exceptions are adopted,
|
||||
they’ll be listed here.
|
||||
When passing an array of values to a function, use `rtc::ArrayView`
|
||||
whenever possible—that is, whenever you’re not passing ownership of
|
||||
the array, and don’t allow the callee to change the array size.
|
||||
|
||||
For example,
|
||||
|
||||
instead of | use
|
||||
------------------------------------|---------------------
|
||||
`const std::vector<T>&` | `ArrayView<const T>`
|
||||
`const T* ptr, size_t num_elements` | `ArrayView<const T>`
|
||||
`T* ptr, size_t num_elements` | `ArrayView<T>`
|
||||
|
||||
See [the source](webrtc/api/array_view.h) for more detailed docs.
|
||||
|
||||
## C
|
||||
|
||||
|
||||
Reference in New Issue
Block a user