How to check if hidl_vec is empty?

  android, c++, googlemock, hal, hidl

In Android, we can use HIDL data types in lieu of normal C++ data types. Their functionality remains mostly the same, and this proxy code is for behind-the-scenes serialization and IPC which HIDL takes care of.

Now when I try to check if a HIDL vector is empty, I get the error that empty is not a member of hidl_vec. How then can I check this? Some other functions that work on a normal vector work with hidl_vec such as foo.size(), foo.begin(), foo.end() but I prefer to not use the size check for this reason.

#include "gmock/gmock.h"
using ::android::hardware::hidl_vec;
using ::android::hardware::hidl_string;

hidl_vec<hidl_string> foo;


Throws the error:

error: no member named ’empty’ in ‘android::hardware::hidl_vecandroid::hardware::hidl_string’

Source: Windows Questions C++