How to convert iterator to corresponding data pointer?

Well it was quite easy in VC6 to work with iterators since iterators were actual pointers to internal data, so they could be used interchangeably. For e.g. [sourcecode language=”cpp”]typedef std::vector IntVector; IntVector IntVecObj; // Push in a thousand ints for( int Index = 0; Index < 1000; ++Index ) {    IntVecObj.push_back( Index + 1 […]
Continue reading…

 

A TCHAR version of std stream and string classes

Quite simple… [sourcecode language=’cpp’]// A TCHAR based std::string typedef std::basic_string tstring; // A TCHAR based std::ifstream; typedef std::basic_ifstream tstream; // A TCHAR based std::stringstream typedef std::basic_stringstream tstringstream;[/sourcecode] So now no need to worry about UNICODE and ANSI, should work as CString, since TCHAR becomes char/wchar_t based on _UNICODE macro definition. Also note that stl has […]
Continue reading…

 

Wanna know the limits of native types?

Use stl class numeric_limits. Wonderful class. It helps you in listing out the Maximum and minimum value for a native type The number of bits taken by a native type Whether a type is signed or unsigned Whether a type can represent a NaN Whether a type can represent positive infinity… etc.. Check out the class […]
Continue reading…