First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
Also you seem to be missing the fundamental requirements for an iterator:
operator*()
operator->()
And I don't think your iterator confirms to any of the standard iterator types. You want to look at that so people know how to use your iterators correctly.
See http://www.sgi.com/tech/stl/Iterators.html for details.
More information here: http://stackoverflow.com/a/1120224/14065 https://stackoverflow.com/a/1120224/14065
First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
Also you seem to be missing the fundamental requirements for an iterator:
operator*()
operator->()
And I don't think your iterator confirms to any of the standard iterator types. You want to look at that so people know how to use your iterators correctly.
See http://www.sgi.com/tech/stl/Iterators.html for details.
More information here: http://stackoverflow.com/a/1120224/14065
First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
Also you seem to be missing the fundamental requirements for an iterator:
operator*()
operator->()
And I don't think your iterator confirms to any of the standard iterator types. You want to look at that so people know how to use your iterators correctly.
See http://www.sgi.com/tech/stl/Iterators.html for details.
More information here: https://stackoverflow.com/a/1120224/14065
First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
Also you seem to be missing the fundamental requirements for an iterator:
operator*()
operator->()
And I don't think your iterator confirms to any of the standard iterator types. You want to look at that so people know how to use your iterators correctly.
See http://www.sgi.com/tech/stl/Iterators.html for details.
More information here: http://stackoverflow.com/a/1120224/14065
First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
More information here: http://stackoverflow.com/a/1120224/14065
First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
Also you seem to be missing the fundamental requirements for an iterator:
operator*()
operator->()
And I don't think your iterator confirms to any of the standard iterator types. You want to look at that so people know how to use your iterators correctly.
See http://www.sgi.com/tech/stl/Iterators.html for details.
More information here: http://stackoverflow.com/a/1120224/14065
First I agree with @Yuushi in this situation you probably should not be writing your own iterator. The ones provided by the vector class should work fine.
But if you are in the situation to write your own iterator you need to do a few more things.
There a set of types that you should be defining (either inside the class or via traits)
typedef std::input_iterator_tag iterator_category;
typedef XXXXXX value_type;
typedef YYYYYY difference_type;
typedef ZZZZZZ pointer;
typedef AAAAAA reference;
More information here: http://stackoverflow.com/a/1120224/14065