<small id='7wMYD'></small><noframes id='7wMYD'>

    1. <legend id='7wMYD'><style id='7wMYD'><dir id='7wMYD'><q id='7wMYD'></q></dir></style></legend>
      • <bdo id='7wMYD'></bdo><ul id='7wMYD'></ul>

        <i id='7wMYD'><tr id='7wMYD'><dt id='7wMYD'><q id='7wMYD'><span id='7wMYD'><b id='7wMYD'><form id='7wMYD'><ins id='7wMYD'></ins><ul id='7wMYD'></ul><sub id='7wMYD'></sub></form><legend id='7wMYD'></legend><bdo id='7wMYD'><pre id='7wMYD'><center id='7wMYD'></center></pre></bdo></b><th id='7wMYD'></th></span></q></dt></tr></i><div id='7wMYD'><tfoot id='7wMYD'></tfoot><dl id='7wMYD'><fieldset id='7wMYD'></fieldset></dl></div>
        <tfoot id='7wMYD'></tfoot>
      1. 错误:'i' 没有用 auto 命名类型

        时间:2023-09-15
          <bdo id='n01sm'></bdo><ul id='n01sm'></ul>
        • <tfoot id='n01sm'></tfoot>
              <tbody id='n01sm'></tbody>

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

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

                  本文介绍了错误:'i' 没有用 auto 命名类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我是 C++ 新手,这是我的程序

                  I am new to C++,here is my program

                  #include <iostream>
                  #include <fstream>
                  #include <algorithm>
                  #include <vector>
                  #include <functional>  
                  
                  int main(){
                  
                  static const double arr[] = {16.0,2.2,77.5,29.0,24.0};
                  std::vector<double> vec (arr, arr + sizeof(arr) / sizeof(arr[0]) );
                  
                  std::transform(vec.begin(), vec.end(), vec.begin(),bind2nd(std::minus<double>(), 3.0)); 
                  
                  for (auto i = vec.begin(); i != vec.end(); ++i)
                      std::cout << *i << ' ';
                  
                  }
                  

                  当我尝试用 g++ p1.cpp -o p1 编译时

                  When I try to compile with g++ p1.cpp -o p1

                  p1.cpp: In function ‘int main()’:
                  p1.cpp:14:11: error: ‘i’ does not name a type
                   for (auto i = vec.begin(); i != vec.end(); ++i)
                  

                  我知道有更多的方法可以打印矢量,但为什么这不起作用?

                  I know that there more ways to print the vector,but why is this not working?

                  推荐答案

                  你应该试试 -std=c++11 .之后工作正常.

                  You should try with -std=c++11 . Works fine after that.

                  ./p1
                  13 -0.8 74.5 26 21 
                  

                  这篇关于错误:'i' 没有用 auto 命名类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:向量内存分配策略 下一篇:boost asio 写/读向量

                  相关文章

                  最新文章

                  <legend id='xUTjf'><style id='xUTjf'><dir id='xUTjf'><q id='xUTjf'></q></dir></style></legend>
                      <tfoot id='xUTjf'></tfoot>
                      • <bdo id='xUTjf'></bdo><ul id='xUTjf'></ul>

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

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