std::map default value for build-in type
Posted
by
Qifa Zhao
on Stack Overflow
See other posts from Stack Overflow
or by Qifa Zhao
Published on 2010-12-24T03:12:00Z
Indexed on
2010/12/24
3:54 UTC
Read the original article
Hit count: 304
Recently, I was confused by the std::map operator[] function. In the MSDN library, it says: "If the argument key value is not found, then it is inserted along with the default value of the data type." I tryed to search much more exactly explanation for this issue. For example here: std::map default value In this page, Michael Anderson said that "the default value is constructed by the default constructor(zero parameter constructor)".
Now my quest comes to this:"what the default value for the build-in type?". Was it compiler related? Or is there a standard for this issue by the c++ stardard committee?
I did a test on visual studio 2008 for the "int" type, and found the "int" type is construted with the value 0.
© Stack Overflow or respective owner