// to have it lightweight). Probably there is already an
// equivalent of this within Boost. If so, TODO: use that one.
// This used to be "box_iterator" and "segment_iterator".
+ // ALTERNATIVE: use boost:array and its iterators
struct points_iterator
: public boost::iterator_facade
<
// Constructor: Begin iterator
inline points_iterator(Point const* p)
: m_points(p)
- , m_index(0)
+ , m_index(0)
{}
// Constructor: End iterator
inline points_iterator(Point const* p, bool)
: m_points(p)
- , m_index(MaxSize)
+ , m_index(MaxSize)
{}
// Constructor: default (for Range Concept checking).
inline points_iterator()
: m_points(NULL)
- , m_index(MaxSize)
+ , m_index(MaxSize)
{}
-
+
typedef std::ptrdiff_t difference_type;
private:
{
return m_points[m_index];
}
-
+
// If it index larger (or smaller) return first point
// (assuming initialized)
return m_points[0];
{
return other.m_index - this->m_index;
}
-
+
inline void advance(difference_type n)
{
m_index += n;
}
Point const* m_points;
- int m_index;
+ difference_type m_index;
};
public :
{
copy.apply(m_points);
}
-
-private :
+
+private :
// Copy points here - box might define them otherwise
Point m_points[MaxSize];
};