0
votes

I write some years ago this compiled with CGAL-4.1:

#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/basic.h>
#include <CGAL/Search_traits_2.h>
#include <CGAL/Search_traits_adapter.h>
#include <CGAL/Kd_tree.h>
#include <CGAL/Fuzzy_iso_box.h>
#include <CGAL/Timer.h>
#include <boost/iterator/zip_iterator.hpp>

#include <utility>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <omp.h>

typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_2 Point_2;
typedef boost::tuple < Point_2, int > Point_and_int;

//definition of the property map
class My_point_property_map
{
public:
    typedef Point_2 value_type;
    typedef const value_type& reference;
    typedef const Point_and_int& key_type;
    typedef boost::lvalue_property_map_tag category;
//    typedef boost::readable_property_map_tag category;


};

//get function for the property map
My_point_property_map::reference
get (My_point_property_map, My_point_property_map::key_type p)
{
  return boost::get <0> (p);
}...

If compiled (CGAL-4.5) with typedef boost::readable_property_map_tag category; the following error occurs:

In file included from /usr/include/CGAL/assertions.h:36:0, from /usr/include/CGAL/basic.h:42, from /usr/include/CGAL/Cartesian/Cartesian_base.h:28, from /usr/include/CGAL/Simple_cartesian.h:28, from /usr/include/CGAL/Exact_predicates_inexact_constructions_kernel.h:28, from /home/bruno/ex_cgal/New_Vellin_omp.cpp:5: /usr/include/CGAL/Search_traits_adapter.h: In instantiation of ‘class CGAL::Search_traits_adapter, int>, My_point_property_map, CGAL::Search_traits_2 >’:/home/bruno/ex_cgal/New_Vellin_omp.cpp:56:38: required from here /usr/include/CGAL/Search_traits_adapter.h:75:3: error: invalid application of ‘sizeof’ to incomplete type ‘boost::STATIC_ASSERTION_FAILURE’ BOOST_STATIC_ASSERT( ( boost::is_same< boost::lvalue_property_map_tag,

If compiled (CGAL-4.5) with typedef boost::lvalue_property_map_tag category;, it works.

Note that with CGAL-4.1 and typedef boost::readable_property_map_tag category; there are no compilation errors.

Missing code:

typedef CGAL::Search_traits_2 < Kernel > Traits_base;
typedef CGAL::Search_traits_adapter < Point_and_int, My_point_property_map, Traits_base > Traits;
typedef CGAL::Fuzzy_iso_box < Traits > Fuzzy_iso_box;
typedef const CGAL::Kd_tree < Traits > Tree;
1
simply use lvalue_property_map_tag. The error you have is a static assertion checking that the property map provided has the requirements needed by the algorithm. - sloriot
Thanks for the answer. kindly I ask you if the two declarations are equivalent. Thanks again. - natan
well what you have is not a model of lvalue property map since the operator[] is missing but it seems that it is not used in this case so it is fine (what matters is the reference returned by get). - sloriot
The error you're getting looks like it's due to the Boost's static assertion library triggering and causing a compilation error. I'm not sure what specifically the static assertion is failing on, though. - templatetypedef

1 Answers

1
votes

I've found that there is a difference in header CGAL, between the two version (CGAL-4.1 vs CGAL-4.5), /usr/include/CGAL/Search_traits_adapter.h In ver_4.1 there is not statement:

BOOST_STATIC_ASSERT( ( boost::is_same< boost::lvalue_property_map_tag, typename boost::property_traits::category>::value ) ); which generate the error.