问题描述
这段代码在VS2013下编译OK:
This code compiled OK under VS2013:
现在使用 VS2015 我得到:
Now with VS2015 I get:
推荐答案
老问题,但供以后参考:这是 Visual Studio 2015 中的一个已知错误,如 此主题 MSDN Social.
Old question, but for future reference: this is a known bug in Visual Studio 2015, as explained in the latest post (January 7th 2016) in this thread of MSDN Social.
您示例的解决方法如下所示(为简单起见,我将您的方法实现为免费函数):
The workaround for your example looks like this (I implemented your method as a free function for simplicity):
希望这个问题能在以后的版本中得到修复,否则#if
条件需要细化.更新:不,在 VS 2017 中未修复.因此,我已将预处理器条件更新为 >=1900
(最初为 ==1900
).
Hopefully, the problem will be fixed in future releases, otherwise the #if
condition will need refining.
UPDATE: nope, not fixed in VS 2017. Therefore, I've updated the preprocessor conditional to >= 1900
(initially was == 1900
).
这篇关于Visual Studio C++ 2015 std::codecvt with char16_t 或 char32_t的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!