Missing std::

This commit is contained in:
Marc Glisse 2006-02-26 00:25:19 +00:00
parent 62b6bf5079
commit 3d1ee0cf13
13 changed files with 44 additions and 34 deletions

View File

@ -35,6 +35,7 @@
***************************************************************************/
#include <ctype.h>
#include <cstring>
#if defined (__BORLANDC__)
#include <mem.h>
#endif
@ -119,19 +120,19 @@ void Real::constructFromString(const char *str, const extLong& prec )
// Moreover, the value of prec is ignored (basically
// assumed to be infinity).
if (strchr(str, '/') != NULL) { // this is a rational number
if (std::strchr(str, '/') != NULL) { // this is a rational number
rep = new RealBigRat(BigRat(str));
return;
}
const char *e = strchr(str, 'e');
const char *e = std::strchr(str, 'e');
int dot = 0;
long e10 = 0;
if (e != NULL)
e10 = atol(e+1); // e10 is decimal precision of the input string
e10 = std::atol(e+1); // e10 is decimal precision of the input string
// i.e., input is A/10^{e10}.
else {
e = str + strlen(str);
e = str + std::strlen(str);
#ifdef CORE_DEBUG
assert(*e == '\0');
#endif
@ -225,7 +226,7 @@ std::istream& operator >>(std::istream& i, Real& x) {
if (p - str == size) {
char *t = str;
str = new char[size*2];
memcpy(str, t, size);
std::memcpy(str, t, size);
delete [] t;
p = str + size;
size *= 2;
@ -251,7 +252,7 @@ std::istream& operator >>(std::istream& i, Real& x) {
int len = p - str;
char *t = str;
str = new char[len + 1];
memcpy(str, t, len);
std::memcpy(str, t, len);
delete [] t;
p = str + len;
}

View File

@ -118,7 +118,7 @@ extLong& extLong::operator*= (const extLong& y) {
} else { // flag == 0 and y.flag == 0
double d = double(val) * double(y.val);
long p = val * y.val;
if (fabs(d - p) <= fabs(d) * relEps) {
if (std::fabs(d - p) <= std::fabs(d) * relEps) {
val = p;
flag = 0;
} else if (d > EXTLONG_MAX) {

View File

@ -22,7 +22,7 @@ int main(int argc, char* argv[])
{
//assert(std::numeric_limits<double>::has_infinity());
if ( argc > 1 ) {
int is_verbose = atoi(argv[1]);
int is_verbose = std::atoi(argv[1]);
if ( is_verbose == 0 ) {
verbose = false;
} else verbose = true;

View File

@ -27,6 +27,7 @@
#include <list>
#include <string>
#include <fstream>
#include <cstdlib>
// Making sure test doesn't fail if LEDA is not installed
#if ! defined(CGAL_USE_LEDA) && \
@ -949,7 +950,7 @@ int main(int argc, char* argv[])
if (argc < 1 || argc > 2) {
std::cout << "usage: test data_file" << std::endl;
exit(1);
std::exit(1);
}
test.start(argv[1]);

View File

@ -25,6 +25,7 @@
#ifdef CGAL_USE_QT
#include <CGAL/IO/Qt_widget_OpenGL.h>
#include <cmath>
namespace CGAL {
@ -88,7 +89,7 @@ void Qt_widget_OpenGL::mouseMoveEvent(QMouseEvent* event) {
int y = event->y();
switch ( interaction) {
case SCALE:
s *= exp( (x - mouse_x + mouse_y -y) * factor_s );
s *= std::exp( (x - mouse_x + mouse_y -y) * factor_s );
break;
case ROTATE: {
double old_x = 1.2 * (mouse_x - window_width/2) / window_radius;

View File

@ -3,6 +3,7 @@
#include <CGAL/MP_Float.h>
#include <CGAL/Snap_rounding_traits_2.h>
#include <CGAL/Snap_rounding_2.h>
#include <cstdlib>
typedef CGAL::Quotient<CGAL::MP_Float> Number_Type;
typedef CGAL::Cartesian<Number_Type> Rep;
@ -18,14 +19,14 @@ void read_data(int argc,char *argv[],Number_Type &prec,std::list<Segment_2> &seg
if(argc != 2) {
std::cerr << "syntex: test <input file name>\n";
exit(1);
std::exit(1);
}
std::ifstream is(argv[1]);
if(is.bad()) {
std::cerr << "Bad input file : " << argv[1] << std::endl;
exit(1);
std::exit(1);
}
is >> number_of_segments;
@ -34,7 +35,7 @@ void read_data(int argc,char *argv[],Number_Type &prec,std::list<Segment_2> &seg
if(number_of_segments < 1) {
std::cerr << "Bad input file(number of segments)" << argv[1] << std::endl;
exit(1);
std::exit(1);
}
for(i = 0;i < number_of_segments;++i) {

View File

@ -5,6 +5,7 @@
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <CGAL/Search_traits_2.h>
#include <list>
#include <cmath>
typedef CGAL::Simple_cartesian<double> K;
@ -30,7 +31,7 @@ int main() {
// report the N nearest neighbors and their distance
// This should sort all N points by increasing distance from origin
for(Neighbor_search::iterator it = search.begin(); it != search.end(); ++it){
std::cout << it->first << " "<< sqrt(it->second) << std::endl;
std::cout << it->first << " "<< std::sqrt(it->second) << std::endl;
}

View File

@ -4,6 +4,7 @@
#include <CGAL/point_generators_2.h>
#include <CGAL/Search_traits_2.h>
#include <CGAL/Orthogonal_k_neighbor_search.h>
#include <cmath>
typedef CGAL::Simple_cartesian<double> R;
typedef R::Point_2 Point_d;
@ -34,7 +35,7 @@ int main() {
// report the N nearest neighbors and their distance
// This should sort all N points by increasing distance from origin
for(Neighbor_search::iterator it = search.begin(); it != search.end(); ++it){
std::cout << it->first << " "<< sqrt(it->second) << std::endl;
std::cout << it->first << " "<< std::sqrt(it->second) << std::endl;
}
return 0;
}

View File

@ -102,13 +102,13 @@ namespace CGAL {
pit = construct_it(p);
if (power == FT(0)) {
for (unsigned int i = 0; qit != qe; ++qit, ++i)
if (the_weights[i] * fabs((*qit) - (*pit)) > distance)
distance = the_weights[i] * fabs((*qit)-(*pit));
if (the_weights[i] * std::fabs((*qit) - (*pit)) > distance)
distance = the_weights[i] * std::fabs((*qit)-(*pit));
}
else
for (unsigned int i = 0; qit != qe; ++qit, ++i)
distance +=
the_weights[i] * pow(fabs((*qit)-(*pit)),power);
the_weights[i] * std::pow(std::fabs((*qit)-(*pit)),power);
return distance;
}
@ -139,10 +139,10 @@ namespace CGAL {
for (unsigned int i = 0; qit != qe; ++qit, ++i) {
if ((*qit) < r.min_coord(i))
distance += the_weights[i] *
pow(r.min_coord(i)-(*qit),power);
std::pow(r.min_coord(i)-(*qit),power);
if ((*qit) > r.max_coord(i))
distance += the_weights[i] *
pow((*qit)-r.max_coord(i),power);
std::pow((*qit)-r.max_coord(i),power);
}
};
return distance;
@ -175,9 +175,9 @@ namespace CGAL {
{
for (unsigned int i = 0; qit != qe; ++qit, ++i) {
if ((*qit) <= (r.min_coord(i)+r.max_coord(i))/FT(2.0))
distance += the_weights[i] * pow(r.max_coord(i)-(*qit),power);
distance += the_weights[i] * std::pow(r.max_coord(i)-(*qit),power);
else
distance += the_weights[i] * pow((*qit)-r.min_coord(i),power);
distance += the_weights[i] * std::pow((*qit)-r.min_coord(i),power);
}
};
return distance;
@ -191,16 +191,16 @@ namespace CGAL {
FT new_dist;
if (power == FT(0))
{
if (the_weights[cutting_dimension]*fabs(new_off)
if (the_weights[cutting_dimension]*std::fabs(new_off)
> dist)
new_dist=
the_weights[cutting_dimension]*fabs(new_off);
the_weights[cutting_dimension]*std::fabs(new_off);
else new_dist=dist;
}
else
{
new_dist = dist + the_weights[cutting_dimension] *
(pow(fabs(new_off),power)-pow(fabs(old_off),power));
(std::pow(std::fabs(new_off),power)-std::pow(std::fabs(old_off),power));
}
return new_dist;
}
@ -210,7 +210,7 @@ namespace CGAL {
transformed_distance(FT d) const
{
if (power <= FT(0)) return d;
else return pow(d,power);
else return std::pow(d,power);
}
@ -219,7 +219,7 @@ namespace CGAL {
inverse_of_transformed_distance(FT d) const
{
if (power <= FT(0)) return d;
else return pow(d,1/power);
else return std::pow(d,1/power);
}

View File

@ -1,5 +1,6 @@
#include <iostream>
#include <fstream>
#include <cstdio>
#include <CGAL/Cartesian.h>
#include <CGAL/Filtered_kernel.h>
@ -25,9 +26,9 @@ int main()
if (i!=11 && i!=12 && i!=17 && i!=18 && i!=20 && i!=21)
{
char name[80];
sprintf(name, "data/%d.vec.cin", i);
std::sprintf(name, "data/%d.vec.cin", i);
char namer[80];
sprintf(namer, "data/%d.stl", i);
std::sprintf(namer, "data/%d.stl", i);
std::ifstream infile(name, std::ios::in);
double iXSize, iYSize;
unsigned int x_samples, y_samples;

View File

@ -19,6 +19,7 @@
#include <iterator>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <list>
#include <CGAL/kdtree_d.h>
@ -35,7 +36,7 @@ int main()
CGAL::Kdtree_d<kd_interface> tree(2);
points_list l, res;
srand( (unsigned)time(NULL) );
std::srand( (unsigned)time(NULL) );
std::cout << "Insering evenly 81 points in the square (0,0)-(10,10) ...\n\n";
for (int i=1; i<10; i++)

View File

@ -19,6 +19,7 @@
#include <iterator>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <list>
#include <CGAL/kdtree_d.h>
@ -38,7 +39,7 @@ typedef std::list<point> points_list;
inline double dblRand( void )
{
return (double)rand() / (double)RAND_MAX;
return (double)std::rand() / (double)RAND_MAX;
}
void random_points( int num, points_list &l )
@ -59,7 +60,7 @@ int main()
{
CGAL::Kdtree_d<kd_interface> tree(3);
srand( (unsigned)time(NULL) );
std::srand( (unsigned)time(NULL) );
std::cout << "Choosing randomly 30 points in the cube (0,0,0)-(10,10,10)\n" ;

View File

@ -20,6 +20,7 @@
#include <iterator>
#include <ctime>
#include <cassert>
#include <cstdlib>
#include <list>
#include <CGAL/kdtree_d.h>
@ -90,7 +91,7 @@ typedef std::list<point> points_list;
inline double dblRand( void )
{
return (double)rand() / (double)RAND_MAX;
return (double)std::rand() / (double)RAND_MAX;
}
void random_points( int num, points_list &l, int DIM)
@ -113,7 +114,7 @@ int main()
{
CGAL::Kdtree_d<kd_interface> tree(3);
srand( (unsigned)time(NULL) );
std::srand( (unsigned)time(NULL) );
std::cout << "Choosing randomly 30 points in the cube (0,0,0)-(10,10,10)\n" ;