Add style guide rules for std::bind and std::function
We keep std::bind forbidden just like before, but suggest another alternative than the Chromium style guide does. We allow std::function, overriding the Chromium style guide which forbids it on grounds not really applicable to WebRTC. Bug: none Change-Id: Iad07485652064a67020a494466d2b212bad568c0 Notry: true Reviewed-on: https://webrtc-review.googlesource.com/63028 Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#22553}
This commit is contained in:
parent
92120972ea
commit
0d44625b8f
@ -109,6 +109,18 @@ implements the signal. It may:
|
||||
sigslot::signal<int>& SignalFoo() { return bar_.SignalFoo(); }
|
||||
```
|
||||
|
||||
### std::bind
|
||||
|
||||
Don’t use `std::bind`—there are pitfalls, and lambdas are almost as
|
||||
succinct and already familiar to modern C++ programmers.
|
||||
|
||||
### std::function
|
||||
|
||||
`std::function` is allowed, but remember that it’s not the right tool
|
||||
for every occasion. Prefer to use interfaces when that makes sense,
|
||||
and consider `rtc::FunctionView` for cases where the callee will not
|
||||
save the function object.
|
||||
|
||||
## **C**
|
||||
|
||||
There’s a substantial chunk of legacy C code in WebRTC, and a lot of
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user