static_casts

This commit is contained in:
Andreas Fabri 2010-06-22 16:17:33 +00:00
parent 57ede1871d
commit f111a29a8f
9 changed files with 28 additions and 28 deletions

View File

@ -77,7 +77,7 @@ Aff_transformationCd(const Matrix& M) : Base( Rep(M) )
template <typename Forward_iterator>
Aff_transformationCd(Scaling, Forward_iterator start, Forward_iterator end) :
Base( Rep(std::distance(start,end)-1) )
Base( Rep(static_cast<int>(std::distance(start,end))-1) )
/*{\Mcreate introduces the transformation of $d$-space specified by a
diagonal matrix with entries |set [start,end)| on the diagonal
(a scaling of the space). \precond |set [start,end)| is a vector of

View File

@ -107,7 +107,7 @@ matrix $M$. \precond |M| is a square matrix of dimension $d + 1$. }*/
template <typename Forward_iterator>
Aff_transformationHd(Scaling, Forward_iterator start, Forward_iterator end) :
Base( Rep(std::distance(start,end)-1) )
Base( Rep(static_cast<int>(std::distance(start,end))-1) )
/*{\Mcreate introduces the transformation of $d$-space specified by a
diagonal matrix with entries |set [start,end)| on the diagonal
(a scaling of the space). \precond |set [start,end)| is a vector of

View File

@ -73,7 +73,7 @@ construct_from_points(ForwardIterator first, ForwardIterator last,
"hyperplane::construction: dimensions disagree.");
int d = first->dimension(); // we are in $d$ - dimensional space
int m = std::distance(first,last); // |P| has $m$ points
int m = static_cast<int>(std::distance(first,last)); // |P| has $m$ points
typename LA::Matrix A(m,d + 1);
for (int i = 0; i < m; i++) { /* define $i$-th equation */

View File

@ -135,7 +135,7 @@ construct_from_points(ForwardIterator first, ForwardIterator last,
"hyperplane::construction: dimensions disagree.");
int d = first->dimension(); // we are in $d$ - dimensional space
int m = std::distance(first,last); // |P| has $m$ points
int m = static_cast<int>(std::distance(first,last)); // |P| has $m$ points
typename LA::Matrix A(m,d + 1);
for (int i = 0; i < m; i++) { /* define $i$-th equation */

View File

@ -221,7 +221,7 @@ void range_initialize(RAIterator first, RAIterator last,
std::random_access_iterator_tag)
{ typedef typename std::iterator_traits<RAIterator>::value_type value_type;
typedef typename value_type::const_iterator const_iterator;
dn_ = last-first;
dn_ = static_cast<int>(last-first);
if (dn_ == 0) { dm_=0; v_=0; return; }
dm_ = first->dimension();
if (dm_ > 0) {

View File

@ -135,7 +135,7 @@ Sphere_d(const Self& c) : Base(c) {}
int dimension() const
/*{\Mop returns the dimension of |\Mvar|.}*/
{ return ptr()->P.size() - 1; }
{ return static_cast<int>(ptr()->P.size()) - 1; }
Point_d point(int i) const
/*{\Mop returns the $i$-th defining point. \precond $0 \le i \le |dim|$.}*/
@ -309,7 +309,7 @@ operator>>(std::istream& is, CGAL::Sphere_d<R>& s)
if (!(is >> p)) return is;
V[d] = p;
}
s = Sphere_d<R>(V.size()-1, V.begin(), V.end() );
s = Sphere_d<R>(static_cast<int>(V.size())-1, V.begin(), V.end() );
return is;
}

View File

@ -167,7 +167,7 @@ Vector_(Forward_iterator first, Forward_iterator last)
Forward_iterator fit = first;
while(fit++!=last) d_++;
#else
d_ = std::distance(first, last);
d_ = static_cast<int>(std::distance(first, last));
#endif
allocate_vec_space(v_,d_);
iterator it = begin();

View File

@ -183,7 +183,7 @@ typedef typename R::LA LA;
template <class ForwardIterator>
Orientation operator()(ForwardIterator first, ForwardIterator last)
{ TUPLE_DIM_CHECK(first,last,Orientation_d);
int d = std::distance(first,last);
int d = static_cast<int>(std::distance(first,last));
// range contains d points of dimension d-1
CGAL_assertion_msg(first->dimension() == d-1,
"Orientation_d: needs first->dimension() + 1 many points.");
@ -210,7 +210,7 @@ Oriented_side operator()(ForwardIterator first, ForwardIterator last,
const Point_d& x)
{
TUPLE_DIM_CHECK(first,last,Side_of_oriented_sphere_d);
int d = std::distance(first,last); // |A| contains |d| points
int d = static_cast<int>(std::distance(first,last)); // |A| contains |d| points
CGAL_assertion_msg((d-1 == first->dimension()),
"Side_of_oriented_sphere_d: needs first->dimension()+1 many input points.");
typename LA::Matrix M(d + 1);
@ -278,7 +278,7 @@ bool operator()(ForwardIterator first, ForwardIterator last,
const Point_d& p)
{
TUPLE_DIM_CHECK(first,last,Contained_in_simplex_d);
int k = std::distance(first,last); // |A| contains |k| points
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| points
int d = first->dimension();
CGAL_assertion_code(
typename R::Affinely_independent_d check_independence; )
@ -319,7 +319,7 @@ bool operator()(ForwardIterator first, ForwardIterator last,
const Point_d& p)
{
TUPLE_DIM_CHECK(first,last,Contained_in_affine_hull_d);
int k = std::distance(first,last); // |A| contains |k| points
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| points
int d = first->dimension();
typename LA::Matrix M(d + 1,k);
typename LA::Vector b(d + 1);
@ -346,7 +346,7 @@ template <class ForwardIterator>
int operator()(ForwardIterator first, ForwardIterator last)
{
TUPLE_DIM_CHECK(first,last,Affine_rank_d);
int k = std::distance(first,last); // |A| contains |k| points
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| points
if (k == 0) return -1;
if (k == 1) return 0;
int d = first->dimension();
@ -369,7 +369,7 @@ typedef typename R::LA LA;
template <class ForwardIterator>
bool operator()(ForwardIterator first, ForwardIterator last)
{ typename R::Affine_rank_d rank;
int n = std::distance(first,last);
int n = static_cast<int>(std::distance(first,last));
return rank(first,last) == n-1;
}
};
@ -393,7 +393,7 @@ template<class ForwardIterator>
bool operator()(
ForwardIterator first, ForwardIterator last, const Vector_d& x)
{ TUPLE_DIM_CHECK(first,last,Contained_in_linear_hull_d);
int k = std::distance(first,last); // |A| contains |k| vectors
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| vectors
int d = first->dimension();
typename LA::Matrix M(d,k);
typename LA::Vector b(d);
@ -412,7 +412,7 @@ typedef typename R::LA LA;
template <class ForwardIterator>
int operator()(ForwardIterator first, ForwardIterator last)
{ TUPLE_DIM_CHECK(first,last,linear_rank);
int k = std::distance(first,last); // k vectors
int k = static_cast<int>(std::distance(first,last)); // k vectors
int d = first->dimension();
typename LA::Matrix M(d,k);
for (int i = 0; i < d ; i++)
@ -428,7 +428,7 @@ typedef typename R::LA LA;
template <class ForwardIterator>
bool operator()(ForwardIterator first, ForwardIterator last)
{ typename R::Linear_rank_d rank;
return rank(first,last) == std::distance(first,last);
return rank(first,last) == static_cast<int>(std::distance(first,last));
}
};
@ -441,7 +441,7 @@ template <class ForwardIterator, class OutputIterator>
OutputIterator operator()(ForwardIterator first, ForwardIterator last,
OutputIterator result)
{ TUPLE_DIM_CHECK(first,last,linear_base);
int k = std::distance(first,last); // k vectors
int k = static_cast<int>(std::distance(first,last)); // k vectors
int d = first->dimension();
typename LA::Matrix M(d,k);
for (int j = 0; j < k; ++first, ++j)

View File

@ -187,7 +187,7 @@ typedef typename R::LA LA;
template <class ForwardIterator>
Orientation operator()(ForwardIterator first, ForwardIterator last)
{ TUPLE_DIM_CHECK(first,last,Orientation_d);
int d = std::distance(first,last);
int d = static_cast<int>(std::distance(first,last));
// range contains d points of dimension d-1
CGAL_assertion_msg(first->dimension() == d-1,
"Orientation_d: needs first->dimension() + 1 many points.");
@ -213,7 +213,7 @@ Oriented_side operator()(ForwardIterator first, ForwardIterator last,
const Point_d& x)
{
TUPLE_DIM_CHECK(first,last,Side_of_oriented_sphere_d);
int d = std::distance(first,last); // |A| contains |d| points
int d = static_cast<int>(std::distance(first,last)); // |A| contains |d| points
CGAL_assertion_msg((d-1 == first->dimension()),
"Side_of_oriented_sphere_d: needs first->dimension()+1 many input points.");
typename LA::Matrix M(d + 1);
@ -287,7 +287,7 @@ bool operator()(ForwardIterator first, ForwardIterator last,
const Point_d& p)
{
TUPLE_DIM_CHECK(first,last,Contained_in_simplex_d);
int k = std::distance(first,last); // |A| contains |k| points
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| points
int d = first->dimension();
CGAL_assertion_code(
typename R::Affinely_independent_d check_independence; )
@ -327,7 +327,7 @@ bool operator()(ForwardIterator first, ForwardIterator last,
const Point_d& p)
{
TUPLE_DIM_CHECK(first,last,Contained_in_affine_hull_d);
int k = std::distance(first,last); // |A| contains |k| points
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| points
int d = first->dimension();
typename LA::Matrix M(d + 1,k);
typename LA::Vector b(p.homogeneous_begin(),p.homogeneous_end());
@ -350,7 +350,7 @@ template <class ForwardIterator>
int operator()(ForwardIterator first, ForwardIterator last)
{
TUPLE_DIM_CHECK(first,last,Affine_rank_d);
int k = std::distance(first,last); // |A| contains |k| points
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| points
if (k == 0) return -1;
if (k == 1) return 0;
int d = first->dimension();
@ -374,7 +374,7 @@ typedef typename R::RT RT;
template <class ForwardIterator>
bool operator()(ForwardIterator first, ForwardIterator last)
{ typename R::Affine_rank_d rank;
int n = std::distance(first,last);
int n = static_cast<int>(std::distance(first,last));
return rank(first,last) == n-1;
}
};
@ -398,7 +398,7 @@ template<class ForwardIterator>
bool operator()(
ForwardIterator first, ForwardIterator last, const Vector_d& x)
{ TUPLE_DIM_CHECK(first,last,Contained_in_linear_hull_d);
int k = std::distance(first,last); // |A| contains |k| vectors
int k = static_cast<int>(std::distance(first,last)); // |A| contains |k| vectors
int d = first->dimension();
typename LA::Matrix M(d,k);
typename LA::Vector b(d);
@ -418,7 +418,7 @@ typedef typename R::RT RT;
template <class ForwardIterator>
int operator()(ForwardIterator first, ForwardIterator last)
{ TUPLE_DIM_CHECK(first,last,linear_rank);
int k = std::distance(first,last); // k vectors
int k = static_cast<int>(std::distance(first,last)); // k vectors
int d = first->dimension();
typename LA::Matrix M(d,k);
for (int i = 0; i < d ; i++)
@ -435,7 +435,7 @@ typedef typename R::RT RT;
template <class ForwardIterator>
bool operator()(ForwardIterator first, ForwardIterator last)
{ typename R::Linear_rank_d rank;
return rank(first,last) == std::distance(first,last);
return rank(first,last) == static_cast<int>(std::distance(first,last));
}
};
@ -449,7 +449,7 @@ template <class ForwardIterator, class OutputIterator>
OutputIterator operator()(ForwardIterator first, ForwardIterator last,
OutputIterator result)
{ TUPLE_DIM_CHECK(first,last,linear_base);
int k = std::distance(first,last); // k vectors
int k = static_cast<int>(std::distance(first,last)); // k vectors
int d = first->dimension();
typename LA::Matrix M(d,k);
for (int j = 0; j < k; j++)