Comment please: begin() method in container class

F

food4uk

Dear all :
I am not good at programming, please give a hand.

My data structure is very similar as an array. I actually can use the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It means
"next position in the object sequence" in STL but now I redefine it to
mean "next position within a 2-d range in the object sequence" (my data
is 2d data). The 2-d range get defined when an iterator get
initialized. Therefore, I think I have to create my own container
class and iterator class.

To reduce my work, I inherit my container class from the std::vector
privately, and try to use the vector::begin(), as it is important for
me to have a begin() in my container, like this:

using std::vector

class container::private vector<DATATYPE>
{

public:
using vector<DATATYPEl>::begin;
}

however, I found that the begin() I got from here returns a
vector:iterator type iterator, which is not what I want. I would like
to see that the container::begin() can return a myIterator type
iterator which enables me to use the customerized definition of its
behivours (such as the definition of "++ "above).

To to that, I make the container::begin() like this :

#inlcude myIterator.h

class container::private vector<DATATYPE>
{

private:
myIterator pIter;
public:
.....
myIterator begin()
{
*pIter=vector<DATATYPE>::front();
return pIter;
}

}

// in myIterator.h , I have:

#include DATATYPE.h

class myIterator {

private:

DATATYPE* current;
.....................

public:

DATATYPE& operator*()
{
return *current;
}
}

I am not sure if it is the correct way to do that. Any one can give me
a hand is highly appreciated.

Thanks in advance.
Sheldon
 
E

eriwik

Dear all :
I am not good at programming, please give a hand.

My data structure is very similar as an array. I actually can use the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It means
"next position in the object sequence" in STL but now I redefine it to
mean "next position within a 2-d range in the object sequence" (my data
is 2d data). The 2-d range get defined when an iterator get
initialized. Therefore, I think I have to create my own container
class and iterator class.

To reduce my work, I inherit my container class from the std::vector
privately, and try to use the vector::begin(), as it is important for
me to have a begin() in my container, like this:

using std::vector

class container::private vector<DATATYPE>
{

public:
using vector<DATATYPEl>::begin;

}however, I found that the begin() I got from here returns a
vector:iterator type iterator, which is not what I want. I would like
to see that the container::begin() can return a myIterator type
iterator which enables me to use the customerized definition of its
behivours (such as the definition of "++ "above).

To to that, I make the container::begin() like this :

#inlcude myIterator.h

class container::private vector<DATATYPE>
{

private:
myIterator pIter;
public:
.....
myIterator begin()
{
*pIter=vector<DATATYPE>::front();
return pIter;
}

}// in myIterator.h , I have:

#include DATATYPE.h

class myIterator {

private:

DATATYPE* current;
.....................

public:

DATATYPE& operator*()
{
return *current;
}

}I am not sure if it is the correct way to do that. Any one can give me
a hand is highly appreciated.

Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.
 
F

food4uk

"(e-mail address removed) 写é“:
"
Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.
 
J

Jim Langston

"(e-mail address removed) ??:
"
Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
..at( 2 * 5 + 3 );

You don't need to create your own container class, because vector supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.
 
F

food4uk

"Jim Langston 写é“:
"
"(e-mail address removed) ??:
"
Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
.at( 2 * 5 + 3 );

You don't need to create your own container class, because vector supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.


Thank you Jim!
The reason for making a customer container is for the iterator. I agree
what you said. but there is some special situations:
say, accroding to your method, If I need to return an iterator in the
position of [2,3](say for a 5x5 array), then the vector::at() will
return a reference of the DATA in the location [2,3], but what I need a
iterator in [2,3] whose behaviours is customer defined, NOT a reference
of DATA.

Off course, you can get an iterator in [2,3], but as I said, this
iterator you got is an std::vector::iterator type NOT myIterator type,
which means that I cannot get myIterator type iterator by using at(),
then I will not be able to use STL algorithm by passing iterators of
myIterator type.

What do you think?

Thank you.
Sheldon
 
J

Jim Langston

"Jim Langston ??:
"
"(e-mail address removed) ??:
"
Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
.at( 2 * 5 + 3 );

You don't need to create your own container class, because vector supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.


Thank you Jim!
The reason for making a customer container is for the iterator. I agree
what you said. but there is some special situations:
say, accroding to your method, If I need to return an iterator in the
position of [2,3](say for a 5x5 array), then the vector::at() will
return a reference of the DATA in the location [2,3], but what I need a
iterator in [2,3] whose behaviours is customer defined, NOT a reference
of DATA.

Off course, you can get an iterator in [2,3], but as I said, this
iterator you got is an std::vector::iterator type NOT myIterator type,
which means that I cannot get myIterator type iterator by using at(),
then I will not be able to use STL algorithm by passing iterators of
myIterator type.

What do you think?

Thank you.
Sheldon

Well, exactly how do you expect your iterator to increment?

If you have a 5 x 5 array, and you are at 2,3, when you increment you expect
it to point to 2,4, right? Increment again, and what should it point to?
You are at the end of the row. Do you want it to point to 3,0?

If this is the behavior you want, then incrementing the normal iterator will
do that exact thing. What other type of behavior would you want?
 
F

food4uk

"Jim Langston 写é“:
"
"Jim Langston ??:
"
"(e-mail address removed) ??:
"
Dear all :
I am not good at programming, please give a hand.

My data structure is very similar as an array. I actually can use the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It means
"next position in the object sequence" in STL but now I redefine it to
mean "next position within a 2-d range in the object sequence" (my
data
is 2d data). The 2-d range get defined when an iterator get
initialized. Therefore, I think I have to create my own container
class and iterator class.

To reduce my work, I inherit my container class from the std::vector
privately, and try to use the vector::begin(), as it is important for
me to have a begin() in my container, like this:

using std::vector

class container::private vector<DATATYPE>
{

public:
using vector<DATATYPEl>::begin;

}however, I found that the begin() I got from here returns a
vector:iterator type iterator, which is not what I want. I would like
to see that the container::begin() can return a myIterator type
iterator which enables me to use the customerized definition of its
behivours (such as the definition of "++ "above).

To to that, I make the container::begin() like this :

#inlcude myIterator.h

class container::private vector<DATATYPE>
{

private:
myIterator pIter;
public:
.....
myIterator begin()
{
*pIter=vector<DATATYPE>::front();
return pIter;
}

}// in myIterator.h , I have:

#include DATATYPE.h

class myIterator {

private:

DATATYPE* current;
.....................

public:

DATATYPE& operator*()
{
return *current;
}

}I am not sure if it is the correct way to do that. Any one can give
me
a hand is highly appreciated.

Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
.at( 2 * 5 + 3 );

You don't need to create your own container class, because vector supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.


Thank you Jim!
The reason for making a customer container is for the iterator. I agree
what you said. but there is some special situations:
say, accroding to your method, If I need to return an iterator in the
position of [2,3](say for a 5x5 array), then the vector::at() will
return a reference of the DATA in the location [2,3], but what I need a
iterator in [2,3] whose behaviours is customer defined, NOT a reference
of DATA.

Off course, you can get an iterator in [2,3], but as I said, this
iterator you got is an std::vector::iterator type NOT myIterator type,
which means that I cannot get myIterator type iterator by using at(),
then I will not be able to use STL algorithm by passing iterators of
myIterator type.

What do you think?

Thank you.
Sheldon

Well, exactly how do you expect your iterator to increment?

If you have a 5 x 5 array, and you are at 2,3, when you increment you expect
it to point to 2,4, right? Increment again, and what should it point to?
You are at the end of the row. Do you want it to point to 3,0?

If this is the behavior you want, then incrementing the normal iterator will
do that exact thing. What other type of behavior would you want?


That is the problem: it to point to 2,4, Increment again, I don't
want it to point to 3,0, I want it points the next one which is 3, 3,
not 3, 0! to then end of this row, increase one , it points to 4,3 not
4,0.

That is why I have to define my own iterator.

What do you think?
 
F

food4uk

"Jim Langston 写é“:
"
"Jim Langston ??:
"
"(e-mail address removed) ??:
"
Dear all :
I am not good at programming, please give a hand.

My data structure is very similar as an array. I actually can use the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It means
"next position in the object sequence" in STL but now I redefine it to
mean "next position within a 2-d range in the object sequence" (my
data
is 2d data). The 2-d range get defined when an iterator get
initialized. Therefore, I think I have to create my own container
class and iterator class.

To reduce my work, I inherit my container class from the std::vector
privately, and try to use the vector::begin(), as it is important for
me to have a begin() in my container, like this:

using std::vector

class container::private vector<DATATYPE>
{

public:
using vector<DATATYPEl>::begin;

}however, I found that the begin() I got from here returns a
vector:iterator type iterator, which is not what I want. I would like
to see that the container::begin() can return a myIterator type
iterator which enables me to use the customerized definition of its
behivours (such as the definition of "++ "above).

To to that, I make the container::begin() like this :

#inlcude myIterator.h

class container::private vector<DATATYPE>
{

private:
myIterator pIter;
public:
.....
myIterator begin()
{
*pIter=vector<DATATYPE>::front();
return pIter;
}

}// in myIterator.h , I have:

#include DATATYPE.h

class myIterator {

private:

DATATYPE* current;
.....................

public:

DATATYPE& operator*()
{
return *current;
}

}I am not sure if it is the correct way to do that. Any one can give
me
a hand is highly appreciated.

Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
.at( 2 * 5 + 3 );

You don't need to create your own container class, because vector supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.


Thank you Jim!
The reason for making a customer container is for the iterator. I agree
what you said. but there is some special situations:
say, accroding to your method, If I need to return an iterator in the
position of [2,3](say for a 5x5 array), then the vector::at() will
return a reference of the DATA in the location [2,3], but what I need a
iterator in [2,3] whose behaviours is customer defined, NOT a reference
of DATA.

Off course, you can get an iterator in [2,3], but as I said, this
iterator you got is an std::vector::iterator type NOT myIterator type,
which means that I cannot get myIterator type iterator by using at(),
then I will not be able to use STL algorithm by passing iterators of
myIterator type.

What do you think?

Thank you.
Sheldon

Well, exactly how do you expect your iterator to increment?

If you have a 5 x 5 array, and you are at 2,3, when you increment you expect
it to point to 2,4, right? Increment again, and what should it point to?
You are at the end of the row. Do you want it to point to 3,0?

If this is the behavior you want, then incrementing the normal iterator will
do that exact thing. What other type of behavior would you want?


That is the problem: it to point to 2,4, Increment again, I don't
want it to point to 3,0, I want it points the next one which is 3, 3,
not 3, 0! to then end of this row, increase one , it points to 4,3 not
4,0.

That is why I have to define my own iterator.

What do you think?
 
G

Guest

"Jim Langston 写é“:


That is the problem: it to point to 2,4, Increment again, I don't
want it to point to 3,0, I want it points the next one which is 3, 3,
not 3, 0! to then end of this row, increase one , it points to 4,3 not
4,0.

Do I understand you correctly that you want it to be a column-iterator
that iterates over a column in your 2d-array? If so then increment is
easy. In fact, as long as you can create some formula for calculating
the next element you can make any kind of iterator you want since the
vector's iterator is random access (a diagonal iterator anyone).

Say you want to iterate over the 3rd column, first create a normal
iterator iter pointing to the beginning of the vector, move the iterator
to the 3rd column (iter += 2) and you are good to go. On increment do
iter += n, where n is the number of columns in the array.

The big question is how you are gonna indicate that you are at the end
of array. One way might be to make your iterator point to vector.end()
after the last element.
 
F

food4uk

"Erik Wikström 写é“:
"The big question is how you are gonna indicate that you are at the end

"of array. One way might be to make your iterator point to vector.end()

"after the last element.

Hi Erik
I actually use my iterator for a sub-image (arbitrary size rectangle)
with my image.
I use the iterator.operator ! to indicate the end of my sub-image.

thank you.
sheldon
 
J

Jim Langston

"Jim Langston ??:
"
"Jim Langston ??:
"
"(e-mail address removed) ??:
"
Dear all :
I am not good at programming, please give a hand.

My data structure is very similar as an array. I actually can use
the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It
means
"next position in the object sequence" in STL but now I redefine it
to
mean "next position within a 2-d range in the object sequence" (my
data
is 2d data). The 2-d range get defined when an iterator get
initialized. Therefore, I think I have to create my own container
class and iterator class.

To reduce my work, I inherit my container class from the std::vector
privately, and try to use the vector::begin(), as it is important
for
me to have a begin() in my container, like this:

using std::vector

class container::private vector<DATATYPE>
{

public:
using vector<DATATYPEl>::begin;

}however, I found that the begin() I got from here returns a
vector:iterator type iterator, which is not what I want. I would
like
to see that the container::begin() can return a myIterator type
iterator which enables me to use the customerized definition of its
behivours (such as the definition of "++ "above).

To to that, I make the container::begin() like this :

#inlcude myIterator.h

class container::private vector<DATATYPE>
{

private:
myIterator pIter;
public:
.....
myIterator begin()
{
*pIter=vector<DATATYPE>::front();
return pIter;
}

}// in myIterator.h , I have:

#include DATATYPE.h

class myIterator {

private:

DATATYPE* current;
.....................

public:

DATATYPE& operator*()
{
return *current;
}

}I am not sure if it is the correct way to do that. Any one can give
me
a hand is highly appreciated.

Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the
formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
.at( 2 * 5 + 3 );

You don't need to create your own container class, because vector
supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.


Thank you Jim!
The reason for making a customer container is for the iterator. I agree
what you said. but there is some special situations:
say, accroding to your method, If I need to return an iterator in the
position of [2,3](say for a 5x5 array), then the vector::at() will
return a reference of the DATA in the location [2,3], but what I need a
iterator in [2,3] whose behaviours is customer defined, NOT a reference
of DATA.

Off course, you can get an iterator in [2,3], but as I said, this
iterator you got is an std::vector::iterator type NOT myIterator type,
which means that I cannot get myIterator type iterator by using at(),
then I will not be able to use STL algorithm by passing iterators of
myIterator type.

What do you think?

Thank you.
Sheldon

Well, exactly how do you expect your iterator to increment?

If you have a 5 x 5 array, and you are at 2,3, when you increment you
expect
it to point to 2,4, right? Increment again, and what should it point to?
You are at the end of the row. Do you want it to point to 3,0?

If this is the behavior you want, then incrementing the normal iterator
will
do that exact thing. What other type of behavior would you want?


That is the problem: it to point to 2,4, Increment again, I don't
want it to point to 3,0, I want it points the next one which is 3, 3,
not 3, 0! to then end of this row, increase one , it points to 4,3 not
4,0.

That is why I have to define my own iterator.

What do you think?

Why are you iterating over the columns instead of the rows? The normal way
to iteratore throught a 2d array is by row first, then colums. Thats why
arrays are stored the way they are, row by row, not column by column.

Okay, but now your problem. You want to iterator through a container in an
arbitrary maner. For that I think you would need to at least wrap the
iterator.
 
F

food4uk

"Jim Langston 写é“:
"
"Jim Langston ??:
"
"Jim Langston ??:
"
"(e-mail address removed) ??:
"
Dear all :
I am not good at programming, please give a hand.

My data structure is very similar as an array. I actually can use
the
std::vector as container to organize my data objects. However, the
behaviours of std::vector::iterator can not meet my requirements. I
need to redefine the vector::iterator's behavious such as ++. It
means
"next position in the object sequence" in STL but now I redefine it
to
mean "next position within a 2-d range in the object sequence" (my
data
is 2d data). The 2-d range get defined when an iterator get
initialized. Therefore, I think I have to create my own container
class and iterator class.

To reduce my work, I inherit my container class from the std::vector
privately, and try to use the vector::begin(), as it is important
for
me to have a begin() in my container, like this:

using std::vector

class container::private vector<DATATYPE>
{

public:
using vector<DATATYPEl>::begin;

}however, I found that the begin() I got from here returns a
vector:iterator type iterator, which is not what I want. I would
like
to see that the container::begin() can return a myIterator type
iterator which enables me to use the customerized definition of its
behivours (such as the definition of "++ "above).

To to that, I make the container::begin() like this :

#inlcude myIterator.h

class container::private vector<DATATYPE>
{

private:
myIterator pIter;
public:
.....
myIterator begin()
{
*pIter=vector<DATATYPE>::front();
return pIter;
}

}// in myIterator.h , I have:

#include DATATYPE.h

class myIterator {

private:

DATATYPE* current;
.....................

public:

DATATYPE& operator*()
{
return *current;
}

}I am not sure if it is the correct way to do that. Any one can give
me
a hand is highly appreciated.

Since you are using a vector you can take advantage of the fact that
it's elements are stored sequentially. However it might be
better/easier to simply make your iterator a wrapper around the
vector's iterator, much like your container.

--
Erik Wikström

Thanks Erik !
I want to do that but actually I can not do it in that way.
Because most behivours of my iterator are different from a "raw pointer
to an array" - like the vector one. For example, the "--" , "++" "+="
etc. all are diffferent, mine iterator is working on a 2-d concept(for
example, a 2-d sub-range area of a 2-d image). But I think the
dereferencing * is the same. So It seems that I can not benefit two
much by wrapping the iterator.

Well, why don't you just use it as a 2D array then using at() the
formula
being:
row * maxrow + column

That is, [2][3] for a 5x5 array would be:
.at( 2 * 5 + 3 );

You don't need to create your own container class, because vector
supports
both [index] and .at(index). The different being .at does out of bounds
checking, [index] doesn't.


Thank you Jim!
The reason for making a customer container is for the iterator. I agree
what you said. but there is some special situations:
say, accroding to your method, If I need to return an iterator in the
position of [2,3](say for a 5x5 array), then the vector::at() will
return a reference of the DATA in the location [2,3], but what I need a
iterator in [2,3] whose behaviours is customer defined, NOT a reference
of DATA.

Off course, you can get an iterator in [2,3], but as I said, this
iterator you got is an std::vector::iterator type NOT myIterator type,
which means that I cannot get myIterator type iterator by using at(),
then I will not be able to use STL algorithm by passing iterators of
myIterator type.

What do you think?

Thank you.
Sheldon

Well, exactly how do you expect your iterator to increment?

If you have a 5 x 5 array, and you are at 2,3, when you increment you
expect
it to point to 2,4, right? Increment again, and what should it point to?
You are at the end of the row. Do you want it to point to 3,0?

If this is the behavior you want, then incrementing the normal iterator
will
do that exact thing. What other type of behavior would you want?


That is the problem: it to point to 2,4, Increment again, I don't
want it to point to 3,0, I want it points the next one which is 3, 3,
not 3, 0! to then end of this row, increase one , it points to 4,3 not
4,0.

That is why I have to define my own iterator.

What do you think?

Why are you iterating over the columns instead of the rows? The normal way
to iteratore throught a 2d array is by row first, then colums. Thats why
arrays are stored the way they are, row by row, not column by column.

Okay, but now your problem. You want to iterator through a container in an
arbitrary maner. For that I think you would need to at least wrap the
iterator.
Hi, Jim
Is it possible to use a customer iterator with the std::vector? if so ,
how ?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top