gpt4 book ai didi

c++ - std::_USE 未定义

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:05:43 25 4
gpt4 key购买 nike

在 2005 年 1 月的版本中,我们有一些使用类 CStdString 的代码,它是 std::string 的包装器。

此类使用宏 SS_USE_FACET 来封装函数 std::use_facet,并为 Microsoft C++ 提供特殊实现。对于 Microsoft 编译器,它使用替代宏 _USE。

我们现在收到一个错误,“_USE 不是 std 的成员”。

如果我在这个宏中注释掉 Microsoft 的特定情况,它可以正常编译。这是宏定义,微软版本被注释掉。

#if defined(__SGI_STL_PORT) && (__SGI_STL_PORT >= 0x400 )

#if defined(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS) && defined(_MSC_VER)
#ifdef SS_ANSI
#pragma schMSG(__STL_NO_EXPLICIT_FUNCTION_TMPL_ARGS defined!!)
#endif
#endif
#define SS_USE_FACET(loc, fac) std::use_facet<fac >(loc)

//#elif defined(_MSC_VER )

// #define SS_USE_FACET(loc, fac) std::_USE(loc, fac)

// ...and
#elif defined(_RWSTD_NO_TEMPLATE_ON_RETURN_TYPE)

#define SS_USE_FACET(loc, fac) std::use_facet(loc, (fac*)0)

#else

#define SS_USE_FACET(loc, fac) std::use_facet<fac >(loc)

#endif

这样可以吗?

我可以假设微软已经采用了标准实现并最终删除了特殊宏 _USE 吗?

最佳答案

您的解决方案(注释掉 MS 特定行并回退到标准 std::use_facet<fac>(loc) )是正确的。

this page底部的微软工程师证实了这一点:

Yes, this non-Standard macro was intentionally removed.

[...]

You should replace such calls with std::use_facet(loc)

关于c++ - std::_USE 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50637134/

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