4 ms·
What's the deal with empty()? I've never used it myself but found people at the new place I work do use it.
by davedx 14y ago
What's the deal with empty()? I've never used it myself but found people at the new place I work do use it.
- leftnode 14y agoLike the article said, you can't use it with function calls because empty() itself is a construct of the language and not a function. So, empty(someFunc()) is an error. You'd have to put the return value of someFunc() in a variable and test it for emptiness, or do something like if (0 == strlen(someFunc())) { /* .. */ } which is overly verbose and not fast.
- deleted 14y ago[deleted]