c++ - 顺序评估前后迭代器增量
问题描述
对不起。我应该改变我的问题。我有以下代码
std::vector<int> v = {10, 20, 30};
auto it = v.begin();
std::cout << *it++ << std::endl; // 1. no parenthesis
std::cout << *(it++) << std::endl; // 2. with parenthesis
it++; // 3. post-increment first
std::cout << *it << std::endl;
std::cout << *(it + 1) << std::endl;// 4. increment index
以上4种说法有什么区别?括号在后增量中重要吗?除了 2(带括号)之外,所有输出都与我的预期相同。
解决方案
推荐阅读
- javascript - 简单的 Rails 应用程序 - 未捕获的 ReferenceError:$ 未定义
- android - web3j 和 web3js 中的签名不同?
- java - CalendarView 在片段中不起作用?安卓
- c# - 无法在 Azure DevOps 2019 通过代码(无权限)创建代理池
- flutter - 未定义命名参数“colors”。flutter
- java - 无法评估具有 [@xsi:type='ED'] 类型的 Xpath xpression
- amazon-web-services - DynamoDB GSI 分区包含大型集
- python - 在 Django 中检索自定义异常的翻译文本
- python - Pandas:如果它们以特定模式开头,如何将行与以前的行合并
- c++ - 避免手动创建 lambda 以包装对 new[]: 的调用以用作 std::generate 中的生成器函数