为什么没有std :: stoui?

时间:2014-01-21 10:01:31

标签: c++ c++11 stl

从c ++ 11开始,<string>标题提供:

要从std::string转换为有符号整数。

我们还有他们的未签名对应方:

现在,即使是小孩也会注意到某些东西丢失了吗? :)

所以问题是:有没有理由不提供std::stoui或者只是被遗忘的东西(基本上这个“显而易见”的东西怎么可能被遗忘)?

此外,这是否意味着将std::string转换为unsigned int的正确方法是:

unsigned int ui = static_cast<unsigned int>(std::stoul(std::string{"42"}));

0 个答案:

没有答案