You can try:
std::stringstream ss;
std::string uuidStr;
boost::uuids::uuid uuid = boost::uuids::random_generator()();
ss << uuid;
ss >> uuidStr;
The documentation reads:
Stream operators
The standard input and output stream operators <and → are provided by enabling boost / uuid / uuid_io.hpp. The uuid string representation is hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh, where h is a hexadecimal digit.
boost::uuids::uuid u1;
std::stringstream ss;
ss << u1;
boost::uuids::uuid u2;
ss >> u2;
assert(u1, u2);
However, it lexical_castshould work.
, , uuid, , - uuid.
:
boost::uuids::uuid u;
std::string s1 = to_string(u);
.