0

お恥ずかしい話ですが、しばらく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;
}

そして、ここにrefがあります。だから明らかに私の試みはうまくいきません:

/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" );

関連する質問:ファイルを 1 行ずつ反復できる C++ イテレータはありますか? 、わかりましたが、CGALに接続できません。アイデアはありますか?

4

1 に答える 1

2

以下を使用できます。

std::ifstream input("input.cin");
std::istream_iterator< Point_2 > input_begin( input );
于 2016-04-14T09:44:52.527 に答える