Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

initial value of pointer value in std map ?

19 views
Skip to first unread message

PGK

unread,
Apr 2, 2009, 6:32:42 AM4/2/09
to
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

ZikO

unread,
Apr 2, 2009, 6:46:35 AM4/2/09
to

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

diane...@gmail.com

unread,
May 15, 2018, 1:52:00 AM5/15/18
to
0 new messages