不好意思问,不过有段时间没用CGAL了。我试图让CGAL 的Convex_hull_2/convex_hull_yz.cpp示例从文件中获取输入,而不是通过 cmd 从重定向中获取输入,例如./convex_hull_yz < convex_hull_yz.cin
. 这是代码:
#include <iostream>
#include <iterator>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Projection_traits_yz_3.h>
#include <CGAL/convex_hull_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K3;
typedef CGAL::Projection_traits_yz_3<K3> K;
typedef K::Point_2 Point_2;
int main()
{
std::istream_iterator< Point_2 > input_begin( std::cin );
std::istream_iterator< Point_2 > input_end;
std::ostream_iterator< Point_2 > output( std::cout, "\n" );
CGAL::convex_hull_2( input_begin, input_end, output, K() );
return 0;
}
这是参考。所以很明显我的尝试是行不通的:
/home/gsamaras/CGAL-4.7/examples/Convex_hull_2/convex_hull_yz.cpp:13:83: error: no matching function for call to ‘std::istream_iterator<CGAL::Point_3<CGAL::Epick> >::istream_iterator(const char [19])’
std::istream_iterator< Point_2 > input_begin( "convex_hull_yz.cin" );
相关问题:是否有可以逐行迭代文件的 C++ 迭代器?,我理解,但我无法与 CGAL 联系。请问有什么想法吗?