user5347919
user5347919

Reputation: 3

const_handle to non_const_handle in CGAL

I am implementing some code in CGAL. I made an arrangement. Now I want to add some data to every face in arrangement. So i access a face by below method. It return const handle. So i try to convert this to non_const_handle. But it show error that " cannot call member function without object."

const Face_const_handle* f;
if(f = boost::get<Face_const_handle>(&(it->second))){

  Arrangement_2::Face_handle fh = Arrangement_2::non_const_handle(*f); // ERROR HERE
  for(int i=1;i<convexPts.size();i++){
    CGAL::Gmpq temp = CGAL::squared_distance(convexPts[0],convexPts[i]);
            if(temp>max){
                max = temp;
                fh->set_data(max);
            }
   }
}

Upvotes: 0

Views: 83

Answers (1)

Efi Fogel
Efi Fogel

Reputation: 1395

Vertex_handle arr.non_const_handle(Vertex_const_handle v)
Halfedge_handle arr.non_const_handle(Halfedge_const_handle e)
Face_handle non_arr.const_handle(Face_const_handle f)

See Arangement_2 template and look for "Casting Away Constness"

Upvotes: 1

Related Questions