initial value of pointer value in std map ?

P

PGK

If I use std::map with pointer values, can I assume they will have an
initial value of zero, when I use the [] operator on a key that
doesn't exist? For example, will this:

map<int, fstream *> m;
cout << m[123];

always output a zero/NULL/0?

Thanks,
Paul
 
Z

ZikO

PGK said:
If I use std::map with pointer values, can I assume they will have an
initial value of zero, when I use the [] operator on a key that
doesn't exist? For example, will this:

map<int, fstream *> m;
cout << m[123];

always output a zero/NULL/0?

Thanks,
Paul

Yes, it will initialize fstream pointer with zero. The same would happen
with simple int, int* etc.
 

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,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top