-
August 5th, 2009, 08:29 AM
#1
custom iterator
I have a class which holds some objects.
To be more specific the class MyClass has an array of 9 "Obj". like this:
Code:
#include"Obj.h"
class MyClass
{
Obj _objects[9];
}
I would like to be able to access these objects with an iterator style object. Since my objects can be accessed with a standard pointer, I shouldn't need to implement the entire iterator class, but just declare a typedef. I am not sure how to do it though.
http://www.cplusplus.com/reference/s...erator_traits/
According to this, I would try to create a class that inherits from iterator_traits<Obj>, but at the same time, a want to write "typedef Obj* iterator"
How should I do this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|