首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >映射迭代器与运算符不匹配

映射迭代器与运算符不匹配
EN

Stack Overflow用户
提问于 2018-09-28 04:04:31
回答 2查看 160关注 0票数 1

我在map迭代器中没有匹配的运算符。当我尝试创建迭代器时,它指向map end-1。

#include <iostream>
#include <map>
int main()
{
    std::map<char,int> mymap;

    mymap['b'] = 100;
    mymap['a'] = 200;
    mymap['c'] = 300;

    // show content:
    for (std::map<char,int>::iterator it=mymap.begin(); it!=mymap.end()-1; ++it){
        std::cout << it->first << " => " << it->second << '\n';
    }
    return 0;
}
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52544364

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档