fork download
  1. #include <boost/uuid/uuid.hpp>
  2. #include <boost/uuid/uuid_generators.hpp>
  3. #include <boost/uuid/uuid_io.hpp>
  4. #include <iostream>
  5.  
  6. int main() {
  7. // This is a random UUID which we'll use as a namespace.
  8. boost::uuids::string_generator gen;
  9. boost::uuids::uuid dns_namespace_uuid = gen("{123e4567-e89b-12d3-a456-426655440000}");
  10.  
  11. // This is our name.
  12. std::string name = "276009026410828";
  13.  
  14. // Generate a UUID based on the DNS namespace and our name.
  15. boost::uuids::name_generator name_gen(dns_namespace_uuid);
  16. boost::uuids::uuid u = name_gen(name);
  17.  
  18. std::cout << u << std::endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
114c7e86-3122-5047-841a-1d86ff3fe7e2