to control key in map stl

A

antani

How can I control if key in stl map exist?

I have a map<Point3i,bool> mapPoint;

I would like control if a point mapPoint[Poin3i(1,1,1)] already exist.
How can I do this?

An information about map stl.
What is time to insert a Point3i and what is time to access to itself
Point3i?

Thanks.
 
J

John Harrison

antani said:
How can I control if key in stl map exist?

I have a map<Point3i,bool> mapPoint;

I would like control if a point mapPoint[Poin3i(1,1,1)] already exist.
How can I do this?

An information about map stl.
What is time to insert a Point3i and what is time to access to itself
Point3i?

Thanks.

if (mapPoint.count(Point3i(1,1,1)))
{
std::cout << "1,1,1 exists";
}
else
{
std::cout << "1,1,1 does not exist";
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top