mirror of https://github.com/CGAL/cgal
VC8 STL iterator fixes
This commit is contained in:
parent
8faa59772e
commit
0635012692
|
|
@ -165,6 +165,8 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
|
||||||
typedef typename Cell_container::iterator Cell_iterator;
|
typedef typename Cell_container::iterator Cell_iterator;
|
||||||
typedef typename Cell_container::reverse_iterator Cell_reverse_iterator;
|
typedef typename Cell_container::reverse_iterator Cell_reverse_iterator;
|
||||||
|
|
||||||
|
typedef typename Cell_container::size_type size_type ;
|
||||||
|
|
||||||
Cell_container active_cells;
|
Cell_container active_cells;
|
||||||
|
|
||||||
// set of input matrices must not be empty:
|
// set of input matrices must not be empty:
|
||||||
|
|
@ -197,6 +199,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
|
||||||
// now start the search:
|
// now start the search:
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
if ( ccd > 1) {
|
if ( ccd > 1) {
|
||||||
// ------------------------------------------------------
|
// ------------------------------------------------------
|
||||||
// divide cells:
|
// divide cells:
|
||||||
|
|
@ -207,12 +210,16 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
|
||||||
// otherwise one of the insert operations might cause
|
// otherwise one of the insert operations might cause
|
||||||
// a reallocation invalidating j
|
// a reallocation invalidating j
|
||||||
// (should typically result in a segfault)
|
// (should typically result in a segfault)
|
||||||
active_cells.reserve( 4 * active_cells.size());
|
// active_cells.reserve( 4 * active_cells.size());
|
||||||
|
|
||||||
for ( Cell_reverse_iterator j( active_cells.rbegin());
|
for ( int j = active_cells.size() - 1 ; j >= 0 ; -- j )
|
||||||
j != active_cells.rend();
|
{
|
||||||
++j) {
|
//for ( Cell_reverse_iterator j( active_cells.rbegin());
|
||||||
|
// j != active_cells.rend();
|
||||||
|
// ++j) {
|
||||||
|
|
||||||
|
Cell lRefCell = active_cells.at(j) ;
|
||||||
|
|
||||||
// upper-left quarter:
|
// upper-left quarter:
|
||||||
// Cell( (*j).matrix(),
|
// Cell( (*j).matrix(),
|
||||||
// (*j).x_min(),
|
// (*j).x_min(),
|
||||||
|
|
@ -221,27 +228,27 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
|
||||||
|
|
||||||
// lower-left quarter:
|
// lower-left quarter:
|
||||||
active_cells.push_back(
|
active_cells.push_back(
|
||||||
Cell( (*j).matrix(),
|
Cell( lRefCell.matrix(),
|
||||||
(*j).x_min(),
|
lRefCell.x_min(),
|
||||||
(*j).y_min() + ccd));
|
lRefCell.y_min() + ccd));
|
||||||
|
|
||||||
// upper-right quarter:
|
// upper-right quarter:
|
||||||
active_cells.push_back(
|
active_cells.push_back(
|
||||||
Cell( (*j).matrix(),
|
Cell( lRefCell.matrix(),
|
||||||
(*j).x_min() + ccd,
|
lRefCell.x_min() + ccd,
|
||||||
(*j).y_min()));
|
lRefCell.y_min()));
|
||||||
|
|
||||||
// lower-right quarter:
|
// lower-right quarter:
|
||||||
active_cells.push_back(
|
active_cells.push_back(
|
||||||
Cell( (*j).matrix(),
|
Cell( lRefCell.matrix(),
|
||||||
(*j).x_min() + ccd,
|
lRefCell.x_min() + ccd,
|
||||||
(*j).y_min() + ccd));
|
lRefCell.y_min() + ccd));
|
||||||
|
|
||||||
} // for all active cells
|
} // for all active cells
|
||||||
} // if ( ccd > 1)
|
} // if ( ccd > 1)
|
||||||
else if ( active_cells.size() <= 1) //!!! maybe handle <= 3
|
else if ( active_cells.size() <= 1) //!!! maybe handle <= 3
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// there has to be at least one cell left:
|
// there has to be at least one cell left:
|
||||||
CGAL_optimisation_assertion( active_cells.size() > 0);
|
CGAL_optimisation_assertion( active_cells.size() > 0);
|
||||||
|
|
||||||
|
|
@ -252,6 +259,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t)
|
||||||
int lower_median_rank = (active_cells.size() - 1) >> 1;
|
int lower_median_rank = (active_cells.size() - 1) >> 1;
|
||||||
int upper_median_rank = (active_cells.size() >> 1);
|
int upper_median_rank = (active_cells.size() >> 1);
|
||||||
|
|
||||||
|
|
||||||
// compute upper median of cell's minima:
|
// compute upper median of cell's minima:
|
||||||
nth_element(active_cells.begin(),
|
nth_element(active_cells.begin(),
|
||||||
active_cells.begin() + upper_median_rank,
|
active_cells.begin() + upper_median_rank,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue