diff --git a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h index 2f502d547bf..13ebf61694a 100644 --- a/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h +++ b/NewKernel_d/include/CGAL/NewKernel_d/Wrapper/Point_d.h @@ -21,6 +21,7 @@ #define CGAL_WRAPPER_POINT_D_H #include +#include #include #include #include @@ -246,8 +247,6 @@ public: template Point_d::Point_d(Point_d &)=default; #endif -//TODO: IO - template std::ostream& operator <<(std::ostream& os, const Point_d& p) { @@ -269,26 +268,20 @@ std::ostream& operator <<(std::ostream& os, const Point_d& p) // TODO: test if the stream is binary or text? template std::istream & -operator>>(std::istream &is, typename Point_d & p) +operator>>(std::istream &is, Point_d & p) { - typedef typename Point_d P; + typedef Point_d P; typedef typename K::FT FT; - std::vector coords; + int dim; + is >> dim; + if(!is) return is; - std::string line; - for(;;) - { - if (!std::getline(is, line)) - return is; - if (line != "") - break; - } - std::stringstream line_sstr(line); - FT temp; - while (line_sstr >> temp) - coords.push_back(temp); + std::vector coords(dim); + for(int i=0;i> coords[i]; - p = P(coords.begin(), coords.end()); + if(is) + p = P(coords.begin(), coords.end()); return is; } diff --git a/NewKernel_d/test/NewKernel_d/Epick_d.cpp b/NewKernel_d/test/NewKernel_d/Epick_d.cpp index bed06b20a03..693a1fe4d09 100644 --- a/NewKernel_d/test/NewKernel_d/Epick_d.cpp +++ b/NewKernel_d/test/NewKernel_d/Epick_d.cpp @@ -622,6 +622,9 @@ void test3(){ std::ostringstream output; output << showit; assert(output.str()=="3 1 2 4"); + std::istringstream input("3 5 6 9"); + input >> showit; + assert(ed(showit,cp(5,6,9))); P t1[]={cp(1,2,3),cp(3,2,1),cp(2,4,2)}; assert(sbds(t1+0,t1+2,cp(2,2,3.414)) == CGAL::ON_BOUNDED_SIDE); assert(sbds(t1+0,t1+2,cp(1,2,3)) == CGAL::ON_BOUNDARY);