【问题标题】:Convert C++ 11 code map with pair into C++ 03 [closed]将带有对的 C++ 11 代码映射转换为 C++ 03 [关闭]
【发布时间】:2020-11-22 02:58:43
【问题描述】:

如何将 C++ 11 代码映射与对转换为 C++ 03

    std::map<string, pair<CO3d*, DWORD>> Entities;
    std::map<string, pair<CO3d*, DWORD>> Objects;
    std::map<string, pair<CO3d*, DWORD>> Others;

正在加载

        Entities[] = { pO3D, 10 };
        Objects[] = { pO3D, 10 };
        Others[] = { pO3D, 10 };

并得到语法错误

syntax error : {
syntax error : missing ';' before '{'

【问题讨论】:

    标签: c++ c++11 c++03


    【解决方案1】:

    您必须在连续的&gt;s 之间放置一个空格,以便在 C++03 中指定模板参数。

        std::map<string, pair<CO3d*, DWORD> > Entities;
        std::map<string, pair<CO3d*, DWORD> > Objects;
        std::map<string, pair<CO3d*, DWORD> > Others;
    

    【讨论】:

    • 现在你不会在 MS 编译器一致性表中找到它......
    • 我还是有错误
    • ```语法错误:{语法错误:缺少';'在'{' ```得到这个错误之前
    • @DavidC.Rankin 当然不是,因为那是new feature in C++11。模板中没有关于 &gt;&gt; 的不符合项,所以 MS 没有列出它
    • @phuclv 抱歉,我不清楚,我不是在说实际的右移差异,我指的是您在Microsoft C++ language conformance table中列出的内容
    猜你喜欢
    • 2013-01-23
    • 1970-01-01
    • 1970-01-01
    • 2010-10-18
    • 2011-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多