gpt4 book ai didi

C++ 开始()和结束()

转载 作者:太空狗 更新时间:2023-10-29 23:24:37 25 4
gpt4 key购买 nike

我正在阅读C++ Primer 5th Edition 这本书。有时,作者会使用函数 beginend

例如:

int ia[3][4] = {0,1,2,3,4,5,6,7,8,9,10,11};

int (*p)[4] = begin(ia);

但是,我得到了错误:

error: ‘begin’ was not declared in this scope

我正在运行 gcc 4.9.2,我使用以下命令进行编译:

g++ -std=c++11 main.cpp

最佳答案

作者可能有类似using namespace std; 的声明或 using std::begin; .您需要输入 std::begin没有其中之一。您可能还需要 #include<iterator> .

关于C++ 开始()和结束(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31139111/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com