add empty/size==0 to style guide

This commit is contained in:
Dane Springmeyer 2012-09-26 12:29:22 -07:00
parent 083ff236b7
commit e954bb1587

View file

@ -153,6 +153,14 @@ If you see bits of code around that do not follow these please don't hesitate to
// 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