我正在尝试以这种方式从boost::compute::detail::sha1生成boost::uuids::uuid :
#include <iostream>
#include "boost/uuid/uuid.hpp"
#include "boost/uuid/uuid_io.hpp"
#include "boost/uuid/string_generator.hpp"
#include "boost/compute/detail/sha1.hpp"
int main(int argc, char* argv[])
{
try
{
boost::compute::detail::sha1 sha1("b888e35f9edf3794760392e1066d69-f43d-452e-8475-a09bae9a2e8500000000-0000-0000-0000-000000000000");
std::string str = sha1;
boost::uuids::uuid uuid = boost::uuids::string_generator()(str); // ERROR HERE!!
}
catch (std::exception& e)
{
std::cerr << "Error occurred: " << e.what() << std::endl;
}
return 0;
}
但是此代码因错误而失败Error occurred: invalid uuid string
(见上文)
我正在使用 Visual Studio 2017,Boost 1.67
我的错误在哪里?如何从 boost::compute::detail::sha1 生成 boost::uuids::uuid
PS:该代码适用于以前的 boost 版本。