• <legend id='TW59d'><style id='TW59d'><dir id='TW59d'><q id='TW59d'></q></dir></style></legend>
  • <tfoot id='TW59d'></tfoot>
  • <small id='TW59d'></small><noframes id='TW59d'>

        <bdo id='TW59d'></bdo><ul id='TW59d'></ul>

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

        初始值设定项列表不适用于 Visual Studio 2012 中的向量?

        Initializer list not working with vector in Visual Studio 2012?(初始值设定项列表不适用于 Visual Studio 2012 中的向量?)

        <small id='CmZ9y'></small><noframes id='CmZ9y'>

          • <bdo id='CmZ9y'></bdo><ul id='CmZ9y'></ul>
                <tbody id='CmZ9y'></tbody>
              <legend id='CmZ9y'><style id='CmZ9y'><dir id='CmZ9y'><q id='CmZ9y'></q></dir></style></legend><tfoot id='CmZ9y'></tfoot>
              • <i id='CmZ9y'><tr id='CmZ9y'><dt id='CmZ9y'><q id='CmZ9y'><span id='CmZ9y'><b id='CmZ9y'><form id='CmZ9y'><ins id='CmZ9y'></ins><ul id='CmZ9y'></ul><sub id='CmZ9y'></sub></form><legend id='CmZ9y'></legend><bdo id='CmZ9y'><pre id='CmZ9y'><center id='CmZ9y'></center></pre></bdo></b><th id='CmZ9y'></th></span></q></dt></tr></i><div id='CmZ9y'><tfoot id='CmZ9y'></tfoot><dl id='CmZ9y'><fieldset id='CmZ9y'></fieldset></dl></div>
                  本文介绍了初始值设定项列表不适用于 Visual Studio 2012 中的向量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  可能的重复:
                  Visual Studio 2012 中的 C++11 功能

                  所以我今天通过 维基百科阅读了 C++11 初始值设定项列表 并看到 C++11 支持标准容器的以下语法:

                  So I was reading up on C++11 initializer lists today via Wikipedia and saw that C++11 supports the following syntax for the standard containers:

                  std::vector<std::string> v = { "xyzzy", "plugh", "abracadabra" };
                  std::vector<std::string> v({ "xyzzy", "plugh", "abracadabra" });
                  std::vector<std::string> v{ "xyzzy", "plugh", "abracadabra" }; 
                  

                  当我在 Visual Studio 2012 中尝试以下操作时,出现编译错误 C2552: 'vecs' : non-aggregates cannot be initialized with initializer list

                  When I try the following in Visual Studio 2012 I get the compilation error C2552: 'vecs' : non-aggregates cannot be initialized with initializer list

                  这是我的代码:

                  #include <vector>
                  
                  using namespace std;
                  
                  int main() {
                      vector<string> vecs = {"h", "g", "e"};
                  }
                  

                  VS2012 不支持初始化列表还是我误解了什么?

                  Does VS2012 not support initializer lists or am I just misunderstanding something?

                  谢谢!

                  推荐答案

                  Visual Studio 2012 不支持初始化列表.

                  Visual Studio 2012 does not support initializer lists.

                  嗯,直到 2012 年 11 月 CTP 才出现.现在确实如此,至少处于 alpha 状态.当然,这段代码仍然无法在其中工作,因为他们仍在将初始化列表放入标准库本身.

                  Well, it didn't until the November 2012 CTP. Now it does, at least in an alpha state. Granted, this code still won't work in it because they're still putting initializer lists into the standard library itself.

                  这篇关于初始值设定项列表不适用于 Visual Studio 2012 中的向量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Consistent pseudo-random numbers across platforms(跨平台一致的伪随机数)
                  Vary range of uniform_int_distribution(改变uniform_int_distribution的范围)
                  What is a seed in terms of generating a random number?(就生成随机数而言,种子是什么?)
                  Is 1.0 a valid output from std::generate_canonical?(1.0 是 std::generate_canonical 的有效输出吗?)
                  Getting big random numbers in C/C++(在 C/C++ 中获取大随机数)
                  What is the best way to generate random numbers in C++?(在 C++ 中生成随机数的最佳方法是什么?)
                      <tbody id='6PI6k'></tbody>

                        <bdo id='6PI6k'></bdo><ul id='6PI6k'></ul>
                      • <small id='6PI6k'></small><noframes id='6PI6k'>

                        <legend id='6PI6k'><style id='6PI6k'><dir id='6PI6k'><q id='6PI6k'></q></dir></style></legend>

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