Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove parametrization of end iterators #2168

Merged
merged 6 commits into from
Jan 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions octree/include/pcl/octree/octree_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ namespace pcl
return Iterator (this, max_depth_arg? max_depth_arg : this->octree_depth_);
};

const Iterator end (unsigned int max_depth_arg = 0u)
const Iterator end ()
{
return Iterator (this, max_depth_arg? max_depth_arg : this->octree_depth_ , NULL);
return Iterator (this, 0, NULL);
};

// Octree leaf node iterators
Expand All @@ -129,9 +129,9 @@ namespace pcl
return LeafNodeIterator (this, max_depth_arg? max_depth_arg : this->octree_depth_);
};

const LeafNodeIterator leaf_end (unsigned int max_depth_arg = 0u)
const LeafNodeIterator leaf_end ()
{
return LeafNodeIterator (this, max_depth_arg? max_depth_arg : this->octree_depth_, NULL);
return LeafNodeIterator (this, 0, NULL);
};

// Octree depth-first iterators
Expand All @@ -143,9 +143,9 @@ namespace pcl
return DepthFirstIterator (this, max_depth_arg? max_depth_arg : this->octree_depth_);
};

const DepthFirstIterator depth_end (unsigned int max_depth_arg = 0u)
const DepthFirstIterator depth_end ()
{
return DepthFirstIterator (this, max_depth_arg? max_depth_arg : this->octree_depth_, NULL);
return DepthFirstIterator (this, 0, NULL);
};

// Octree breadth-first iterators
Expand All @@ -157,9 +157,9 @@ namespace pcl
return BreadthFirstIterator (this, max_depth_arg? max_depth_arg : this->octree_depth_);
};

const BreadthFirstIterator breadth_end (unsigned int max_depth_arg = 0u)
const BreadthFirstIterator breadth_end ()
{
return BreadthFirstIterator (this, max_depth_arg? max_depth_arg : this->octree_depth_, NULL);
return BreadthFirstIterator (this, 0, NULL);
};


Expand Down
17 changes: 11 additions & 6 deletions octree/include/pcl/octree/octree_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,17 @@ namespace pcl
*/
bool operator==(const OctreeIteratorBase& other) const
{
return (this == &other) ||
((octree_ == other.octree_) &&
(max_octree_depth_ == other.max_octree_depth_) &&
((current_state_ == other.current_state_) || // end state case
(current_state_ && other.current_state_ && // null dereference protection
(current_state_->key_ == other.current_state_->key_))));
if (this == &other) // same object
return true;
if (octree_ != other.octree_) // refer to different octrees
return false;
if (!current_state_ && !other.current_state_) // both are end iterators
return true;
if (max_octree_depth_ == other.max_octree_depth_ &&
current_state_ && other.current_state_ && // null dereference protection
current_state_->key_ == other.current_state_->key_)
return true;
return false;
}

/** \brief Inequal comparison operator
Expand Down
Loading