mercredi 25 mars 2015

Using `libuuid` with C++11

I'm looking to use libuuid with a C++11 program. However, I think I might be going about this incorrectly. According to uuid.h, the uuid_t is a unsigned char array of 16 items (expected). My approach to building a std::string with this was as follows:



uuid_t uuidObj;
uuid_generate(uuidObj);
std::string aString;

for (auto i = 0; i < 15; ++i)
{
aString += uuidObj[i];
}


I know that this can't be the most approriate solution (while avoiding a malloc in C++11, yikes!), any tips from y'all?


Aucun commentaire:

Enregistrer un commentaire