gpt4 book ai didi

c++ - 没有 std::to_u16string 或 std::to_u32string 吗?

转载 作者:太空宇宙 更新时间:2023-11-04 16:29:54 25 4
gpt4 key购买 nike

<分区>

我很高兴标准库有一个 to_string 函数,但现在我处于 WTF 模式。首先,为什么这不是模板化的,其次,如果它不是返回值的模板,那么为什么他们在世界上没有 to_u16string()to_u32string() 函数。

我知道有 boost lexical cast,但我很想知道是否有一种标准方法可以在不手动编写这些函数的情况下获得我想要的东西?

编辑:更糟糕的是,boost 1.46 也不喜欢 u16string :(

boost::lexical_cast<u16string>(22.44);

terminate called after throwing an instance of 'boost::exception_detail::clone_impl

' what(): bad lexical cast: source type value could not be interpreted as target

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com