int -> size_type/std::size_t

This commit is contained in:
Andreas Fabri 2010-06-21 13:19:03 +00:00
parent 5069faed6b
commit 8e75125383
23 changed files with 135 additions and 118 deletions

View File

@ -164,7 +164,7 @@ for the location of \ccc{p}.}
{Equivalent to \ccc{insert(p)}.}
\ccMethod{template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last);}
{Inserts the points in the range
$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$.

View File

@ -204,7 +204,7 @@ for the location of \ccc{p}.}
{Equivalent to \ccc{insert(p)}.}
\ccMethod{template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last);}
{Inserts the points in the range
$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$.

View File

@ -155,7 +155,7 @@ to be given by \ccc{(lt,loc,li)}.}
{Equivalent to \ccc{insert(p)}.}
\ccMethod{template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last);}
{Inserts the points in the range
$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$.

View File

@ -122,7 +122,7 @@ given by \ccc{(lt,loc,li)}, see the description of member function
{equivalent to \ccc{insert(p)}.}
\ccMethod{template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last);}
{inserts the points in the range
$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$.

View File

@ -206,7 +206,7 @@ located in \ccc{lt,loc,li}.}
{Equivalent to \ccc{insert(p)}.}
\ccMethod{template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last);}
{inserts the weighted points in the range
$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$.

View File

@ -496,7 +496,7 @@ algorithm of where to start.
{Equivalent to \ccc{insert(p)}.}
\ccMethod{template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last);}
{Inserts the points in the range
$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$.

View File

@ -46,6 +46,7 @@ public:
typedef typename Ctr::Edge Edge;
typedef typename Ctr::Finite_faces_iterator Finite_faces_iterator;
typedef typename Ctr::Face_circulator Face_circulator;
typedef typename Ctr::size_type size_type;
typedef typename Ctr::Locate_type Locate_type;
typedef typename Ctr::List_edges List_edges;
@ -152,7 +153,7 @@ public:
Face_handle loc, int li );
Vertex_handle push_back(const Point& a);
// template < class InputIterator >
// int insert(InputIterator first, InputIterator last);
// size_type insert(InputIterator first, InputIterator last);
void remove(Vertex_handle v);
void remove_incident_constraints(Vertex_handle v);
@ -190,12 +191,12 @@ public:
public:
template < class InputIterator >
#if defined(_MSC_VER)
int insert(InputIterator first, InputIterator last, int i = 0)
size_type insert(InputIterator first, InputIterator last, int i = 0)
#else
int insert(InputIterator first, InputIterator last)
size_type insert(InputIterator first, InputIterator last)
#endif
{
int n = number_of_vertices();
size_type n = number_of_vertices();
std::vector<Point> points (first, last);
spatial_sort (points.begin(), points.end(), geom_traits());

View File

@ -54,6 +54,7 @@ public:
typedef typename Triangulation::Vertex Vertex;
typedef typename Triangulation::Vertex_handle Vertex_handle;
typedef typename Triangulation::Face_handle Face_handle;
typedef typename Triangulation::size_type size_type;
typedef typename Triangulation::Locate_type Locate_type;
typedef typename Triangulation::All_faces_iterator All_faces_iterator;
typedef typename Triangulation::Face_circulator Face_circulator;
@ -254,12 +255,12 @@ public:
// the int parameter is a work around for VC7 to compile
template < class InputIterator >
#if defined(_MSC_VER)
int insert(InputIterator first, InputIterator last, int i = 0)
size_type insert(InputIterator first, InputIterator last, int i = 0)
#else
int insert(InputIterator first, InputIterator last)
size_type insert(InputIterator first, InputIterator last)
#endif
{
int n = number_of_vertices();
size_type n = number_of_vertices();
std::vector<Point> points (first, last);
CGAL::spatial_sort (points.begin(), points.end(), geom_traits());

View File

@ -135,7 +135,7 @@ public:
void insert_constraint(Vertex_handle va, Vertex_handle vb);
// template < class InputIterator >
// int insert(InputIterator first, InputIterator last);
// size_type insert(InputIterator first, InputIterator last);
Vertex_handle push_back(const Point& a);
void push_back(const Constraint& c);
@ -205,12 +205,12 @@ public:
public:
template < class InputIterator >
#if defined(_MSC_VER)
int insert(InputIterator first, InputIterator last, int i = 0)
size_type insert(InputIterator first, InputIterator last, int i = 0)
#else
int insert(InputIterator first, InputIterator last)
size_type insert(InputIterator first, InputIterator last)
#endif
{
int n = number_of_vertices();
size_type n = number_of_vertices();
std::vector<Point> points (first, last);

View File

@ -66,7 +66,7 @@ public:
H_vertex_it vertices_begin() { return enclosing->begin();}
H_vertex_it current() {return pos;}
H_vertex_it vertices_end() {return enclosing->end();}
int number_of_vertices() {return enclosing->size();}
std::size_t number_of_vertices() {return enclosing->size();}
};
typedef std::list<H_context> H_context_list;
typedef typename std::list<H_context>::iterator H_context_iterator;
@ -114,11 +114,11 @@ public:
void oriented_end(T va, T vb, T& vc) const;
H_context context(T va, T vb);
int number_of_enclosing_constraints(T va, T vb);
std::size_t number_of_enclosing_constraints(T va, T vb);
H_context_iterator contexts_begin(T va, T vb);
H_context_iterator contexts_end(T va, T vb);
int number_of_constraints() { return c_to_sc_map.size();}
int number_of_subconstraints() {return sc_to_c_map.size();}
std::size_t number_of_constraints() { return c_to_sc_map.size();}
std::size_t number_of_subconstraints() {return sc_to_c_map.size();}
// insert/remove
@ -338,7 +338,7 @@ context(T va, T vb)
}
template <class T, class Data>
int
std::size_t
Constraint_hierarchy_2<T,Data>::
number_of_enclosing_constraints(T va, T vb)
{

View File

@ -49,6 +49,7 @@ public:
typedef Triangulation_2<Gt,Tds> Triangulation;
typedef typename Triangulation::size_type size_type;
typedef typename Triangulation::Locate_type Locate_type;
typedef typename Triangulation::Face_handle Face_handle;
typedef typename Triangulation::Vertex_handle Vertex_handle;
@ -270,10 +271,10 @@ public:
}
template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last)
{
int n = this->number_of_vertices();
size_type n = this->number_of_vertices();
std::vector<Point> points (first, last);
spatial_sort (points.begin(), points.end(), geom_traits());
@ -2268,7 +2269,7 @@ move_if_no_collision(Vertex_handle v, const Point &p) {
return v;
}
int n_vertices = this->tds().number_of_vertices();
size_type n_vertices = this->tds().number_of_vertices();
if((lt == Triangulation::OUTSIDE_AFFINE_HULL) &&
(dim == 1) && (n_vertices == 3)) {
@ -2342,19 +2343,19 @@ move_if_no_collision(Vertex_handle v, const Point &p) {
// fixing pointer
Face_circulator fc = this->incident_faces(inserted), done(fc);
std::vector<Face_handle> faces_pt;
faces_pt.reserve(16);
faces_pt.reserve(16);
do { faces_pt.push_back(fc); } while(++fc != done);
int ss = faces_pt.size();
for(int k=0; k<ss; k++)
{
Face_handle f = faces_pt[k];
int i = f->index(inserted);
f->set_vertex(i, v);
}
v->set_point(p);
v->set_face(inserted->face());
std::size_t ss = faces_pt.size();
for(std::size_t k=0; k<ss; k++)
{
Face_handle f = faces_pt[k];
int i = f->index(inserted);
f->set_vertex(i, v);
}
v->set_point(p);
v->set_face(inserted->face());
this->delete_vertex(inserted);
return v;
@ -2472,7 +2473,7 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v,
return v;
}
int n_vertices = this->tds().number_of_vertices();
size_type n_vertices = this->tds().number_of_vertices();
if((lt == Triangulation::OUTSIDE_AFFINE_HULL) &&
(dim == 1) && (n_vertices == 3)) {

View File

@ -338,10 +338,10 @@ private:
public:
template < class InputIterator >
int
size_type
insert(InputIterator first, InputIterator last)
{
int n = number_of_vertices();
size_type n = number_of_vertices();
std::vector<Weighted_point> points (first, last);
spatial_sort (points.begin(), points.end(), geom_traits());

View File

@ -274,7 +274,7 @@ public:
Locate_type lt,
Face_handle loc, int li );
// template < class InputIterator >
// int insert(InputIterator first, InputIterator last);
// size_type insert(InputIterator first, InputIterator last);
Vertex_handle push_back(const Point& a);
void remove_degree_3(Vertex_handle v, Face_handle f = Face_handle());
@ -492,9 +492,9 @@ Stream& draw_triangulation(Stream& os) const
}
template < class InputIterator >
int insert(InputIterator first, InputIterator last)
size_type insert(InputIterator first, InputIterator last)
{
int n = number_of_vertices();
size_type n = number_of_vertices();
std::vector<Point> points (first, last);
spatial_sort (points.begin(), points.end(), geom_traits());
@ -1390,8 +1390,8 @@ make_hole ( Vertex_handle v, std::list<Edge> & hole)
to_delete.push_back(f);
} while(fc != done);
int size = to_delete.size();
for(int i=0; i<size; i++) {
std::size_t size = to_delete.size();
for(std::size_t i=0; i<size; i++) {
f = to_delete[i];
delete_face(f);
}
@ -1426,8 +1426,8 @@ make_hole(Vertex_handle v, std::list<Edge> & hole,
to_delete.push_back(f);
} while(fc != done);
int size = to_delete.size();
for(int i=0; i<size; i++) {
std::size_t size = to_delete.size();
for(std::size_t i=0; i<size; i++) {
f = to_delete[i];
faces_set.erase(f);
delete_face(f);
@ -1961,7 +1961,7 @@ move_if_no_collision(Vertex_handle v, const Point &p) {
return v;
}
int n_vertices = tds().number_of_vertices();
size_type n_vertices = tds().number_of_vertices();
if((lt == OUTSIDE_AFFINE_HULL) && (dim == 1) && (n_vertices == 3)) {
v->set_point(p);
@ -2029,15 +2029,15 @@ move_if_no_collision(Vertex_handle v, const Point &p) {
std::vector<Face_handle> faces_pt;
faces_pt.reserve(16);
do { faces_pt.push_back(fc); } while(++fc != done);
int ss = faces_pt.size();
for(int k=0; k<ss; k++)
{
Face_handle f = faces_pt[k];
int i = f->index(inserted);
f->set_vertex(i, v);
}
v->set_point(p);
v->set_face(inserted->face());
std::size_t ss = faces_pt.size();
for(std::size_t k=0; k<ss; k++)
{
Face_handle f = faces_pt[k];
int i = f->index(inserted);
f->set_vertex(i, v);
}
v->set_point(p);
v->set_face(inserted->face());
delete_vertex(inserted);
return v;
@ -2049,12 +2049,12 @@ Triangulation_2<Gt,Tds>::
move(Vertex_handle v, const Point &p) {
CGAL_triangulation_precondition(!is_infinite(v));
if(v->point() == p) return v;
Vertex_handle w = move_if_no_collision(v,p);
if(w != v) {
remove(v);
return w;
}
return v;
Vertex_handle w = move_if_no_collision(v,p);
if(w != v) {
remove(v);
return w;
}
return v;
}
template <class Gt, class Tds >
@ -2082,16 +2082,16 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v,
return v;
}
int n_vertices = tds().number_of_vertices();
int n_vertices = tds().number_of_vertices();
if((lt == OUTSIDE_AFFINE_HULL) && (dim == 1) && (n_vertices == 3)) {
v->set_point(p);
v->set_point(p);
for(All_faces_iterator afi = tds().face_iterator_base_begin();
afi != tds().face_iterator_base_begin();
afi++) *oif++ = afi;
for(All_faces_iterator afi = tds().face_iterator_base_begin();
afi != tds().face_iterator_base_begin();
afi++) *oif++ = afi;
return v;
return v;
}
if((lt != OUTSIDE_AFFINE_HULL) && (dim == 1)) {
@ -2121,37 +2121,37 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v,
v->set_face(inserted->face());
delete_vertex(inserted);
}
*oif++ = v->face();
*oif++ = v->face();
if(v->face()->neighbor(0)->has_vertex(v))
*oif++ = v->face()->neighbor(0);
*oif++ = v->face()->neighbor(0);
if(v->face()->neighbor(1)->has_vertex(v))
*oif++ = v->face()->neighbor(1);
*oif++ = v->face()->neighbor(1);
return v;
}
if((lt != OUTSIDE_AFFINE_HULL) && test_dim_down(v)) {
// verify if p and two static vertices are collinear in this case
int iinf;
Face_circulator finf = incident_faces(infinite_vertex()), fdone(finf);
do {
if(!finf->has_vertex(v))
{
iinf = ~(finf->index(infinite_vertex()));
break;
}
} while(++finf != fdone);
if(this->orientation(finf->vertex(iinf&1)->point(),
finf->vertex(iinf&2)->point(),
p) == COLLINEAR)
{
v->set_point(p);
_tds.dim_down(loc, loc->index(v));
return v;
}
// verify if p and two static vertices are collinear in this case
int iinf;
Face_circulator finf = incident_faces(infinite_vertex()), fdone(finf);
do {
if(!finf->has_vertex(v))
{
iinf = ~(finf->index(infinite_vertex()));
break;
}
} while(++finf != fdone);
if(this->orientation(finf->vertex(iinf&1)->point(),
finf->vertex(iinf&2)->point(),
p) == COLLINEAR)
{
v->set_point(p);
_tds.dim_down(loc, loc->index(v));
return v;
}
for(All_faces_iterator afi = tds().face_iterator_base_begin();
afi != tds().face_iterator_base_begin();
afi++) *oif++ = afi;
for(All_faces_iterator afi = tds().face_iterator_base_begin();
afi != tds().face_iterator_base_begin();
afi++) *oif++ = afi;
}
@ -2166,21 +2166,21 @@ move_if_no_collision_and_give_new_faces(Vertex_handle v,
fc = this->incident_faces(inserted), done(fc);
std::vector<Face_handle> faces_pt;
faces_pt.reserve(16);
faces_pt.reserve(16);
do { faces_pt.push_back(fc); } while(++fc != done);
int ss = faces_pt.size();
for(int k=0; k<ss; k++)
{
Face_handle f = faces_pt[k];
int i = f->index(inserted);
f->set_vertex(i, v);
}
v->set_point(p);
v->set_face(inserted->face());
int ss = faces_pt.size();
for(int k=0; k<ss; k++)
{
Face_handle f = faces_pt[k];
int i = f->index(inserted);
f->set_vertex(i, v);
}
v->set_point(p);
v->set_face(inserted->face());
delete_vertex(inserted);
for(typename std::set<Face_handle>::iterator ib = faces_set.begin(),
iend = faces_set.end(); ib != iend; ib++) *oif++ = *ib;
iend = faces_set.end(); ib != iend; ib++) *oif++ = *ib;
return v;
}

View File

@ -100,9 +100,9 @@ public:
Vertex_handle push_back(const Point &p);
template < class InputIterator >
int insert(InputIterator first, InputIterator last)
size_type insert(InputIterator first, InputIterator last)
{
int n = this->number_of_vertices();
size_type n = this->number_of_vertices();
std::vector<Point> points (first, last);
CGAL::spatial_sort (points.begin(), points.end(), geom_traits());

View File

@ -93,7 +93,7 @@ _test_cls_const_Del_triangulation(const Triangul&)
std::back_inserter(hole_bd));
assert(hole_bd.size() == conflicts.size() + 2);
conflicts.clear();
unsigned int nch = hole_bd.size();
std::size_t nch = hole_bd.size();
hole_bd.clear();
T2.find_conflicts(Point(0,1,2), hole_bd);
assert(hole_bd.size() == nch);

View File

@ -122,7 +122,7 @@ _test_cls_delaunay_triangulation_2( const Del & )
assert(conflicts.empty());
conflicts.clear();
T2.get_conflicts(Point(-1,-1,1), std::back_inserter(conflicts));
unsigned int ns = conflicts.size();
std::size_t ns = conflicts.size();
conflicts.clear();
T2.find_conflicts(Point(-1,-1,1), conflicts);
assert(conflicts.size() == ns);

View File

@ -119,8 +119,8 @@ _test_cls_hierarchy_2()
assert( ch.number_of_constraints() == h.number_of_constraints());
assert( ch.number_of_subconstraints() == h.number_of_subconstraints());
ch.clear();
int nc = h.number_of_constraints();
int nsc = h.number_of_subconstraints();
std::size_t nc = h.number_of_constraints();
std::size_t nsc = h.number_of_subconstraints();
ch.swap(h);
assert (ch.number_of_constraints() == nc);
assert( ch.number_of_subconstraints() == nsc);

View File

@ -811,7 +811,7 @@ _test_cls_regular_triangulation_2( const Triangulation & )
T2_3_1.remove(V2_31_17);
T2_3_1.is_valid(verbose);
int i;
Cls::size_type i;
T2_5.clear();
assert( T2_5.number_of_vertices() == 0 );

View File

@ -875,7 +875,7 @@ _test_cls_triangulation_2( const Triangul & )
T2_3.remove(v2_3_10); assert(T2_3.is_valid());
assert( T2_3.number_of_vertices() == 0 );
int i;
Triangul::size_type i;
for (i=T2_4.number_of_vertices(); i>0; i--)
T2_4.remove(T2_4.finite_vertex());
assert( T2_4.number_of_vertices() == 0 );

View File

@ -509,7 +509,7 @@ _test_cls_triangulation_short_2( const Triangul &)
T2_3.remove(v2_3_1); assert(T2_3.is_valid());
assert( T2_3.number_of_vertices() == 0 );
int i;
Triangul::size_type i;
for (i=T2_4.number_of_vertices(); i>0; i--)
T2_4.remove(T2_4.finite_vertex());
assert( T2_4.number_of_vertices() == 0 );

View File

@ -117,9 +117,9 @@ _test_circulators( const Tr &T )
}
//Check Total
int mf = T.number_of_faces() + nch;
int mv = T.number_of_vertices() +1;
int me ;
Tr::size_type mf = T.number_of_faces() + nch;
Tr::size_type mv = T.number_of_vertices() +1;
Tr::size_type me ;
if (T.dimension() <= 0) me=0;
else me = T.dimension() == 1 ? mv : 3*mv-6 ;

View File

@ -45,7 +45,7 @@ _test_iterators( const Triangulation &T )
}
template < class Triangulation >
int
typename Triangulation::size_type
_test_cls_face_iterator( const Triangulation &T )
{
typedef typename Triangulation::Finite_faces_iterator
@ -140,7 +140,7 @@ _test_cls_point_iterator( Triangulation &T )
}
assert( np == T.number_of_vertices() );
int n=np;
size_type n=np;
for (pit = T.points_end();
pit != T.points_begin();
--pit)

View File

@ -20,6 +20,15 @@
// coordinator : INRIA Sophia-Antipolis
// ============================================================================
#include <CGAL/basic.h>
#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable:4661) // Explicit instantiation will not
// instatiate template member functions
#endif
#include <iostream>
#include <CGAL/_test_types.h>
@ -31,6 +40,7 @@
#include <CGAL/_test_traits.h>
#include <CGAL/_test_cls_delaunay_triangulation_2.h>
// Explicit instantiation of the whole class :
template class CGAL::Delaunay_triangulation_2<TestK>;
@ -72,3 +82,7 @@ int main()
std::cout << "done" << std::endl;
return 0;
}
#if defined(BOOST_MSVC)
# pragma warning(pop)
#endif