use size_t to avoid int-narrowing

This commit is contained in:
Joachim Schöberl 2017-05-31 07:52:45 +02:00
parent 97f4c17d96
commit 76e6aaecb1

View File

@ -106,7 +106,7 @@ namespace netgen
double * pt; double * pt;
public: public:
Ng_Point (double * apt) : pt(apt) { ; } Ng_Point (double * apt) : pt(apt) { ; }
double operator[] (int i) double operator[] (size_t i)
{ return pt[i]; } { return pt[i]; }
operator const double * () { return pt; } operator const double * () { return pt; }
}; };
@ -122,11 +122,11 @@ namespace netgen
class Ng_Elements class Ng_Elements
{ {
public: public:
int ne; size_t ne;
const int * ptr; const int * ptr;
int Size() const { return ne; } size_t Size() const { return ne; }
int operator[] (int i) const { return ptr[i]; } int operator[] (size_t i) const { return ptr[i]; }
}; };
@ -146,8 +146,8 @@ namespace netgen
public: public:
const int * ptr; const int * ptr;
int Size() const { return 2; } size_t Size() const { return 2; }
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; } int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; }
}; };
@ -163,21 +163,21 @@ namespace netgen
class Ng_Vertices class Ng_Vertices
{ {
public: public:
int nv; size_t nv;
const int * ptr; const int * ptr;
int Size() const { return nv; } size_t Size() const { return nv; }
int operator[] (int i) const { return ptr[i]-POINTINDEX_BASE; } int operator[] (size_t i) const { return ptr[i]-POINTINDEX_BASE; }
}; };
class Ng_Edges class Ng_Edges
{ {
public: public:
int ned; size_t ned;
const int * ptr; const int * ptr;
int Size() const { return ned; } size_t Size() const { return ned; }
int operator[] (int i) const { return ptr[i]-1; } int operator[] (size_t i) const { return ptr[i]-1; }
}; };