@Peter87 - It wouldn't surprise me; throughout this entire semester, he's given us bad information and he frequently mixes things up. The end() method isn't correct either, that was just my first stab at getting something in there; I'm just trying to get begin() to work before tackling the other methods.
@ne555 - See what I just wrote to Peter87; it wouldn't surprise me if that's wrong. Regarding the missing cursor, I know what you're saying but when I try to add that additional parameter, it still doesn't compile. Without the cursor parameter, I get:
no matching function for call to 'STLDataBuffer::Iterator::Iterator(STLDataBuffer&)'
|
The compiler (GCC with -std=c++0x) tells me a candidate is 'STLDataBuffer::Iterator::Iterator(STLDataBuffer*, int)' but if I add an int (I.E. 0 or 'cursor') to that 'return new...' statement, I get:
no matching function for call to 'STLDataBuffer::Iterator::Iterator(STLDataBuffer&, int)'
|
We're just dealing with a simple integer array and the assignment is simply to iterate through the array and 'cout' the elements. This is the main() he gave us to use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
#include <iostream>
#include "DataBuffer.h"
#include "STLDataBuffer.h"
using namespace std;
int main()
{
STLDataBuffer buffer;
const int ARR0_LEN = 3;
int arr0[ARR0_LEN] = { 4, 7, 3 };
buffer.copyFromArray(arr0, ARR0_LEN);
for (STLDataBuffer::Iterator iter = buffer.begin(); iter != buffer.end();
iter++)
cout << *iter << " ";
cout << endl;
int arr[] = { 3, 6, 8, 9, 1, 5, 3, 2, 7, 12, 4, 8 };
buffer.copyFromArray(arr, 12);
for (STLDataBuffer::Iterator iter = buffer.begin(); iter != buffer.end();
iter++)
cout << *iter << " ";
cout << endl;
return 0;
}
|
FYI, the 'DataBuffer' class is from a previous assignment and is unchanged for this assignment, 'STLDataBuffer' is supposed to just be a sub-class of 'DataBuffer'.