GMP 是否有将标准字符串转换为整数的函数?
函数mpz_init_set_str
初始化并将 char* 转换为 int。
我想知道是否支持标准字符串?
最佳答案
只需使用 c_str() 函数即可访问底层字符数组:
std::string str;
mpz_t strg;
mpz_init_set_str(strg, str.c_str(), 10);
关于c++ - GMP:将整数转换为 std::string,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54148304/