<i id='xsebh'><tr id='xsebh'><dt id='xsebh'><q id='xsebh'><span id='xsebh'><b id='xsebh'><form id='xsebh'><ins id='xsebh'></ins><ul id='xsebh'></ul><sub id='xsebh'></sub></form><legend id='xsebh'></legend><bdo id='xsebh'><pre id='xsebh'><center id='xsebh'></center></pre></bdo></b><th id='xsebh'></th></span></q></dt></tr></i><div id='xsebh'><tfoot id='xsebh'></tfoot><dl id='xsebh'><fieldset id='xsebh'></fieldset></dl></div>
    <tfoot id='xsebh'></tfoot>
  1. <small id='xsebh'></small><noframes id='xsebh'>

    <legend id='xsebh'><style id='xsebh'><dir id='xsebh'><q id='xsebh'></q></dir></style></legend>

      • <bdo id='xsebh'></bdo><ul id='xsebh'></ul>

      Visual c++“为每个"可移植性

      时间:2023-10-06
    1. <legend id='2LoIk'><style id='2LoIk'><dir id='2LoIk'><q id='2LoIk'></q></dir></style></legend>

      <small id='2LoIk'></small><noframes id='2LoIk'>

    2. <tfoot id='2LoIk'></tfoot>

    3. <i id='2LoIk'><tr id='2LoIk'><dt id='2LoIk'><q id='2LoIk'><span id='2LoIk'><b id='2LoIk'><form id='2LoIk'><ins id='2LoIk'></ins><ul id='2LoIk'></ul><sub id='2LoIk'></sub></form><legend id='2LoIk'></legend><bdo id='2LoIk'><pre id='2LoIk'><center id='2LoIk'></center></pre></bdo></b><th id='2LoIk'></th></span></q></dt></tr></i><div id='2LoIk'><tfoot id='2LoIk'></tfoot><dl id='2LoIk'><fieldset id='2LoIk'></fieldset></dl></div>
        <tbody id='2LoIk'></tbody>
          <bdo id='2LoIk'></bdo><ul id='2LoIk'></ul>

              1. 本文介绍了Visual c++“为每个"可移植性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我最近才发现 Visual C++ 2008(也许还有更早的版本?)支持 stl 列表等上的 for each 语法以促进迭代.例如:

                I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as well?) supports for each syntax on stl lists et al to facilitate iteration. For example:

                list<Object> myList;
                
                for each (Object o in myList)
                {
                  o.foo();
                }
                

                我很高兴发现它,但是当有人决定我需要能够在 gcc 或其他一些编译器中编译我的代码时,我担心可怕的一天的可移植性.这种语法是否得到广泛支持,我可以使用它而不必担心可移植性问题吗?

                I was very happy to discover it, but I'm concerned about portability for the dreaded day when someone decides I need to be able to compile my code in say, gcc or some other compiler. Is this syntax widely supported and can I use it without worrying about portability issues?

                推荐答案

                对于每个不是标准的 C 或 C++ 语法.如果您希望能够在 gcc 或 g++ 中编译此代码,则需要创建一个迭代器并使用标准 for 循环.

                For each is not standard C or C++ syntax. If you want to be able to compile this code in gcc or g++, you will need to create an iterator and use a standard for loop.

                量子皮特

                这似乎是 MS Visual C++ 中引入的一项新功能,因此这绝对是不可移植的.参考:http://msdn.microsoft.com/en-us/library/xey702bw%28VS.80%29.aspx [/edit]

                [edit] This seems to be a new feature introduced into MS Visual C++, so this is definitely not portable. Ref: http://msdn.microsoft.com/en-us/library/xey702bw%28VS.80%29.aspx [/edit]

                这篇关于Visual c++“为每个"可移植性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何从 LPCTSTR 转换为 std::string? 下一篇:为什么 MSVC 选择 long long 作为 -2147483648 的类型?

                相关文章

                最新文章

                  <legend id='urzWW'><style id='urzWW'><dir id='urzWW'><q id='urzWW'></q></dir></style></legend>
                    <bdo id='urzWW'></bdo><ul id='urzWW'></ul>

                1. <small id='urzWW'></small><noframes id='urzWW'>

                  1. <tfoot id='urzWW'></tfoot>
                    <i id='urzWW'><tr id='urzWW'><dt id='urzWW'><q id='urzWW'><span id='urzWW'><b id='urzWW'><form id='urzWW'><ins id='urzWW'></ins><ul id='urzWW'></ul><sub id='urzWW'></sub></form><legend id='urzWW'></legend><bdo id='urzWW'><pre id='urzWW'><center id='urzWW'></center></pre></bdo></b><th id='urzWW'></th></span></q></dt></tr></i><div id='urzWW'><tfoot id='urzWW'></tfoot><dl id='urzWW'><fieldset id='urzWW'></fieldset></dl></div>