std::_USE 未定义

std::_USE not defined

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

这个class使用一个宏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)