Checking whether an element exist or not in the map within map

前端 未结 5 898
庸人自扰
庸人自扰 2021-01-24 22:07

I have a map of the form map > :

For Example: I am storing the intensity value at 2-D co-ordinate(x,y) i

5条回答
  •  盖世英雄少女心
    2021-01-24 22:42

    You can use std::map::find and check if the element exists before accessing it. You can read the usage/documentation here: http://en.cppreference.com/w/cpp/container/map/find

提交回复
热议问题