Implements iterator for Castable. properties (++,–,*) for a
#include <iostream>
#include "drain/CastableIterator.h"
#include "drain/String.h"
using namespace std;
int main(int argc, char **argv){
int intArray[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
const CastableIterator end = & intArray[10];
for (CastableIterator it = & intArray[0]; it != end; ++it)
cout << *it << ' ';
cout << endl;
double doubleArray[5] = {0.1, 0.2, 0.3, 0.4, 0.5};
const CastableIterator endD = & doubleArray[5];
CastableIterator itI = intArray;
CastableIterator itD = doubleArray;
while (itD != endD){
*itD = *itI;
*itD = 1.2f * static_cast<float>(*itD);
cout << *itD << ' ';
++itD, ++itI;
}
cout << endl;
return 0;
}
Definition: DataSelector.cpp:1277