cpplint complains that declaration of swap function needs #include <utility>
Reported by
kwiberg@webrtc.org,
Sep 28 2017
|
|||
Issue description
I'm adding a class that declares a swap function in its .h file:
class PayloadUnion {
public:
...
friend void swap(PayloadUnion& a, PayloadUnion& b);
and defines it in its .cc file:
void swap(PayloadUnion& a, PayloadUnion& b) {
using std::swap;
swap(a.Audio, b.Audio);
swap(a.Video, b.Video);
swap(a.is_audio_, b.is_audio_);
}
Presubmit (specifically, cpplint.py) correctly complained that the .cc file needs to #include <utility> since it uses std::swap.
However, it also complains that the .h file needs to #include <utility>. AFAICT this is wrong, since the .h file makes no reference to std::swap.
(CL where the problem appeared: https://webrtc-review.googlesource.com/c/src/+/4340)
,
Oct 1 2017
avakulenko: do you know why we see this?
,
Feb 11 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by kjellander@chromium.org
, Oct 1 2017