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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top