ENH: Fix Cppcheck possible inefficient checking for emptiness warning

Change-Id: I49d0bd3ca1845266e0ce8563aa8891181aef728b
Merge topic 'FixCppcheckSTLSizeWarning'

1f7b2d7 ENH: Fix Cppcheck possible inefficient checking for emptiness warning