Fixed uninitialized iterators problem

This commit is contained in:
Fernando Cacciola 2006-12-11 14:46:55 +00:00
parent 372fe0cfce
commit 721515e9c1
1 changed files with 13 additions and 8 deletions

View File

@ -28,6 +28,8 @@
#include <algorithm>
#include <CGAL/Kd_tree_rectangle.h>
#include <boost/optional.hpp>
namespace CGAL {
template <class Traits>
@ -43,7 +45,10 @@ public:
typedef typename Point_vector::iterator iterator;
private:
iterator b, e; // the iterator range of the Point_container
// the iterator range of the Point_container
boost::optional<iterator> m_b ;
boost::optional<iterator> m_e ;
int built_coord; // a coordinate for which the pointer list is built
Kd_tree_rectangle<Traits> bbox; // bounding box, i.e. rectangle of node
@ -195,29 +200,29 @@ public:
inline unsigned int
size() const
{
return e - b;
return *m_e - *m_b;
}
inline iterator
begin() const {
return b;
return *m_b;
}
inline iterator
end() const
{
return e;
return *m_e;
}
inline bool
empty() const
{
return b == e;
return !m_b;
}
// building the container from a sequence of Point_d*
Point_container(const int d, iterator begin, iterator end) :
b(begin), e(end), bbox(d, begin, end), tbox(bbox)
m_b(begin), m_e(end), bbox(d, begin, end), tbox(bbox)
{
built_coord = max_span_coord();
}
@ -225,8 +230,8 @@ public:
void
set_range(iterator begin, iterator end)
{
b = begin;
e = end;
m_b = begin;
m_e = end;
}