Find your pillow, boring entry inbound...
1,406
2
Advertisement
Recently I've been working on random stuff, mostly non-graphical, like scripting and now also a difference engine.
However when reading on STL iterators, I found a "bug" in Cprogramming.com s tutorial, as you can see an excerpt from here:
I looked at this and realised that the first example wont even compile, at least not on my compiler(DevC++), this is because the vectors can only be indexed(or whatever) by an unsigned integer or STL iterator and not by a regular integer. So yeah! They have a bug in their tutorial.
Oh and the difference engine is going good. I'm gonna try and port it to PHP since thats where it's gonna be used: at my friend's site.
I'm gonna install a new network card, I'll see you on the other side [smile].
However when reading on STL iterators, I found a "bug" in Cprogramming.com s tutorial, as you can see an excerpt from here:
The old approach (avoid) using namespace std;vector<int> myIntVector;// Add some elements to myIntVectormyIntVector.push_back(1);myIntVector.push_back(4);myIntVector.push_back(8);for(int y=0; y{ cout<" "; //Should output 1 4 8}--------------------------The STL approach (use this) using namespace std;vector<int> myIntVector;vector<int>::iterator myIntVectorIterator;// Add some elements to myIntVectormyIntVector.push_back(1);myIntVector.push_back(4);myIntVector.push_back(8);for(myIntVectorIterator = myIntVector.begin(); myIntVectorIterator != myIntVector.end(); myIntVectorIterator++){ cout<<*myIntVectorIterator<<" "; //Should output 1 4 8}I looked at this and realised that the first example wont even compile, at least not on my compiler(DevC++), this is because the vectors can only be indexed(or whatever) by an unsigned integer or STL iterator and not by a regular integer. So yeah! They have a bug in their tutorial.
Oh and the difference engine is going good. I'm gonna try and port it to PHP since thats where it's gonna be used: at my friend's site.
I'm gonna install a new network card, I'll see you on the other side [smile].
Advertisement
Advertisement
Advertisement
Discussion