In many cases, when it is needed to check if a container not empty, "size()" or "empty()" functions are used:
if (vect.size() != 0) {
// vector is not empty
}
if (!vect.empty()) {
// vector is not empty
}
It seems that both variants are not expressive enough, so an explicit function may be required, like:
if (vect.not_empty()) {
// vector is not empty
}
In this message I would like to suggest to use of a bool casting operator as the most clean form of this function:
if (vect) {
// vector is not empty
}
The proposal seems to be backward compatible because until now there was no bool casting operator defined in standard container classes.
(and it is not possible to define a global one).
--