Working with the STL iterators

Almost every programmer some how gets involved with STL iterators while programming. I’m quite fond of these concepts. So what exactly is an iterator? STL stands for the Standard Template Library which has different flavors or implementations floating around with different compilers but the concept and structure behind all of them is the same. It’s […]
Continue reading…

 

Using std transform function

So what does std::transform function do? “Applies a specified function object to each element in a source range or to a pair of elements from two source ranges and copies the return values of the function object into a destination range.” Some general applications of using transform is as follows… For doing some kind of operation […]
Continue reading…

 

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…