add empty/size==0 to style guide
This commit is contained in:
parent
083ff236b7
commit
e954bb1587
1 changed files with 8 additions and 0 deletions
|
@ -153,6 +153,14 @@ If you see bits of code around that do not follow these please don't hesitate to
|
||||||
// more...
|
// more...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### Prefer `empty()` over `size() == 0` if container supports it
|
||||||
|
|
||||||
|
This avoids implicit conversions to bool and reduces compiler warnings.
|
||||||
|
|
||||||
|
if (container.empty()) // please
|
||||||
|
|
||||||
|
if (container.size() == 0) // no
|
||||||
|
|
||||||
|
|
||||||
### Other C++ style resources
|
### Other C++ style resources
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue