Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > How to store range iterator?

Thread Tools

How to store range iterator?

Posts: n/a
I have a view class for a vector, which stores different range for a
few vectors, and provides a way to iterate over the range.
The range class takes a pair of iterator, as given in post

However, as the range class do not have a default ctor, and range is
not known when view class is constructed I can not initialize range
class at initialization list.Thus I need to store range class pointer
inside view class. When I want to set a new range for the view class, I

void CC::setPtuRange(const PointRange& range){
_reconstructedPoints = new PointRange(range);
where _reconstructedPoints is a range class for CC (member variable).
Also I set it only once (but not at constructor). At constructor it is
initialized as NULL & destructor deleted.
Also when I return the range class, I use
PointRange CC:oints()const{
return *_reconstructedPoints;
PointRange is typedef as
typedef PointBuffer::const_iterator PointIterator;
typedef range<PointIterator> PointRange
where PointBuffer is a vector<Point>
My questions are,
1) is it valid to return a value for the pointer with dereferencing
operator? Or I need to return a pointer directly?
2) can I also return a a reference? What is the best way to do it?
Thanks for any help .

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How can I transform source range to destination range that is thesame as source? Lambda C++ 2 07-16-2008 05:18 PM
range() is not the best way to check range? Python 46 07-25-2006 08:10 PM
Scene range vs dynamic range Robert Feinman Digital Photography 2 07-04-2005 09:30 PM
Range does not take an Range object. Tomoyuki Kosimizu Ruby 3 11-27-2003 12:42 AM