标签:
UUID全称通用唯一识别码,被广泛应用于分布式系统中,让所有的元素具有唯一的标识。
stout中UUID类继承自boost::uuids::uuid。api如下:
废话不多说,上示例代码:
#include "stout/uuid.hpp" #include <iostream> int main() { UUID a = UUID::random(); UUID b = UUID::fromBytes(a.toBytes()); UUID c = UUID::fromString(a.toString()); std::cout << a.toString() << "," << b.toString() << "," << c.toString() << std::endl; return 0; }
标签:
原文地址:http://www.cnblogs.com/taiyang-li/p/5887064.html