If you add a Watch for std::vector using array subscript operator, like, myVector, then Visual Studio 2010 instead of showing value, will show the error: ‘CXX0058: Error: overloaded operator not found’. However when you cover std::vector with mouse, the tooltip watch will show correct values.
The workaround for the STL vector is to use: myVector._Myfirst
instead of myVector
intArray.push_back(30); std::vector::const_iterator iterator = intArray.begin();
intArray.push_back(30); auto iterator = intArray.begin();
As you see, ‘std::vector::const_iterator iterator’ becomes ‘auto iterator’. No more unnecessary typing.
The same concept in C# is available from version 3.0. Variables that are declared at method scope can have an implicit type var. An implicitly typed local variable is strongly typed just as if you had declared the type yourself, but the compiler determines the type. Reference.
P.S. Open source world are using auto keyword for at least a year. Support for auto keyword was added to GCC beginning from version 4.4.0
It seems that _SECURE_SCL_THROWS is deprecated in Visual Studio C++ 2010. Because include file ‘Microsoft Visual Studio 10.0\VC\include\yvals.h’ has the following code block:
#pragma _CRT_WARNING( _DEPRECATE_SECURE_SCL_THROWS )
It gets undefined, and if you search c++ header files, there are no references to _SECURE_SCL_THROWS anymore. The strange part is, that latest documentation still have reference to _SECURE_SCL_THROWS, which states that it is valid macro, and ‘Defines whether incorrect use of Checked Iterators causes an exception or a program termination’.
The good news is, that _SECURE_SCL is enabled by default, that causes _ITERATOR_DEBUG_LEVEL to be enabled, that causes iterators to break program debug version if you do something wrong with stl iterators.