diff --git a/Kernel_23/include/CGAL/Bbox.h b/Kernel_23/include/CGAL/Bbox.h index 656d3b02a66..1d2f10976f3 100644 --- a/Kernel_23/include/CGAL/Bbox.h +++ b/Kernel_23/include/CGAL/Bbox.h @@ -21,6 +21,7 @@ #include #include #include +#include #include namespace CGAL { @@ -164,12 +165,25 @@ template class Bbox, T> : public Impl::Bbox, Bbox,T>> { enum { D = N }; + using array_const_iterator = typename std::array::const_iterator; public: + using Cartesian_const_iterator = Concatenate_iterator; + inline constexpr int dimension() const { return D; } Bbox(int d = 0 ) { CGAL_assertion(d==N || d==0); this->init(d ); } Bbox(int d, const T& range) { CGAL_assertion(d==N || d==0); this->init(d, range); } template Bbox(int d, I b, I e) { CGAL_assertion(d==N || d==0); this->init(d, b, e); } + + Cartesian_const_iterator cartesian_begin() const + { + return Cartesian_const_iterator(min_values.end(), max_values.begin(), min_values.begin()); + } + + Cartesian_const_iterator cartesian_end() const + { + return Cartesian_const_iterator(min_values.end(), max_values.begin(), max_values.end(),0); + } }; // A dynamic D-dimensional axis aligned box diff --git a/Kernel_23/test/Kernel_23/test_bbox.cpp b/Kernel_23/test/Kernel_23/test_bbox.cpp index bd984b64fd4..8741f83948b 100644 --- a/Kernel_23/test/Kernel_23/test_bbox.cpp +++ b/Kernel_23/test/Kernel_23/test_bbox.cpp @@ -99,5 +99,12 @@ int main() assert(CGAL::do_overlap(bb3, bb3b)); std::cout << bb3b << std::endl; + + BBox3::Cartesian_const_iterator beg = bb3b.cartesian_begin(); + BBox3::Cartesian_const_iterator end = bb3b.cartesian_end(); + for(; beg != end; ++beg){ + std::cout << *beg << std::endl; + } + } }