C++ Boost Geometry error: no matching function for call to 'assertion_failed'

删除回忆录丶 提交于 2020-07-05 10:18:46

问题


I am trying to test if a Polygon is contained within another Polygon using Boost library. I just started writing my code using this as an example, and got a massive compile error even before I could begin my main block. (It was so massive SO threw an error stating question body length exceeded limit of 30000 chars). My code goes as

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>

int main(int argc, char** argv)
{
   typedef boost::geometry::model::polygon<boost::tuple<int, int> > polygon;
   polygon poly;
   return 0;
}

However, this generates massive compile error which goes as below. This is partial output, complete output is at http://dpaste.com/2W2HZFD

Pranavs-MacBook-Pro: pranav$ g++ bp.cpp
In file included from bp.cpp:1:
In file included from /usr/local/include/boost/geometry.hpp:17:
In file included from /usr/local/include/boost/geometry/geometry.hpp:26:
In file included from /usr/local/include/boost/geometry/core/coordinate_dimension.hpp:24:
/usr/local/include/boost/geometry/core/point_type.hpp:45:5: error: no matching function for call to 'assertion_failed'
    BOOST_MPL_ASSERT_MSG
    ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:435:48: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
                                               ^
/usr/local/include/boost/mpl/assert.hpp:429:9: note: expanded from macro '\
BOOST_MPL_ASSERT_MSG_IMPL'
        boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:60:58: note: expanded from macro '\
BOOST_MPL_AUX_ASSERT_CONSTANT'
#   define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
                                                         ^
/usr/local/include/boost/geometry/core/point_type.hpp:65:30: note: in instantiation of template class
      'boost::geometry::traits::point_type<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
            typename traits::point_type<Geometry>::type
                             ^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:58:22: note: in instantiation of template class
      'boost::geometry::core_dispatch::point_type<void, boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >' requested here
    typedef typename point_type<GeometryTag, Geometry>::type point_type;
                     ^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:88:37: note: in instantiation of template class
      'boost::geometry::core_dispatch::coordinate_type<void, boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >' requested here
    typedef typename core_dispatch::coordinate_type
                                    ^
/usr/local/include/boost/geometry/geometries/concepts/point_concept.hpp:98:22: note: in instantiation of template class
      'boost::geometry::coordinate_type<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
    typedef typename coordinate_type<Geometry>::type ctype;
                     ^
/usr/local/include/boost/concept/detail/has_constraints.hpp:32:63: note: in instantiation of template class
      'boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
  inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
                                                              ^
/usr/local/include/boost/concept/detail/has_constraints.hpp:44:25: note: while substituting deduced template arguments into function template
      'has_constraints_' [with Model = boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >]
      , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );
                        ^
/usr/local/include/boost/config/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'
#     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
                                                                       ^
/usr/local/include/boost/mpl/if.hpp:63:68: note: in instantiation of template class
      'boost::concepts::not_satisfied<boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> > >' requested here
          BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
                                                                   ^
/usr/local/include/boost/mpl/aux_/value_wknd.hpp:57:40: note: expanded from macro 'BOOST_MPL_AUX_VALUE_WKND'
#   define BOOST_MPL_AUX_VALUE_WKND(C) C
                                       ^
/usr/local/include/boost/mpl/aux_/static_cast.hpp:24:62: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
#   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
                                                             ^
/usr/local/include/boost/concept/detail/general.hpp:51:10: note: in instantiation of template class
      'boost::mpl::if_<boost::concepts::not_satisfied<boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type> > >, boost::concepts::constraint<boost::geometry::concept::Point<boost::tuples::tuple<int, int,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >, boost::concepts::requirement<boost::concepts::failed
      ************boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >::************> >' requested here
  : mpl::if_<
         ^
/usr/local/include/boost/geometry/geometries/polygon.hpp:79:5: note: in instantiation of template class 'boost::concepts::requirement_<void
      (*)(boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >)>' requested
      here
    BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
    ^
/usr/local/include/boost/concept/assert.hpp:43:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
    BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
    ^
/usr/local/include/boost/concept/detail/general.hpp:78:25: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
    &::boost::concepts::requirement_<ModelFnPtr>::failed>    \
                        ^
bp.cpp:8:12: note: in instantiation of template class 'boost::geometry::model::polygon<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type>, true, true, std::vector, std::vector, std::allocator, std::allocator>' requested here
   polygon poly;
           ^
/usr/local/include/boost/mpl/assert.hpp:83:5: note: candidate function [with C = false] not viable: no known conversion from 'boost::mpl::failed
      ************(boost::geometry::traits::point_type<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::************)(types<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type> >)' to 'typename assert<false>::type' (aka 'mpl_::assert<false>') for 1st argument
int assertion_failed( typename assert<C>::type );
    ^
In file included from bp.cpp:1:
In file included from /usr/local/include/boost/geometry.hpp:17:
In file included from /usr/local/include/boost/geometry/geometry.hpp:28:
/usr/local/include/boost/geometry/core/coordinate_type.hpp:43:5: error: no matching function for call to 'assertion_failed'
    BOOST_MPL_ASSERT_MSG
    ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:435:48: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
                                               ^
/usr/local/include/boost/mpl/assert.hpp:429:9: note: expanded from macro '\
BOOST_MPL_ASSERT_MSG_IMPL'
        boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:60:58: note: expanded from macro '\
BOOST_MPL_AUX_ASSERT_CONSTANT'
#   define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
                                                         ^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:67:30: note: in instantiation of template class 'boost::geometry::traits::coordinate_type<int,
      void>' requested here
    typedef typename traits::coordinate_type
                             ^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:61:22: note: in instantiation of template class
      'boost::geometry::core_dispatch::coordinate_type<boost::geometry::point_tag, int>' requested here
    typedef typename coordinate_type<point_tag, point_type>::type type;
                     ^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:88:37: note: in instantiation of template class
      'boost::geometry::core_dispatch::coordinate_type<void, boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >' requested here
    typedef typename core_dispatch::coordinate_type
                                    ^
/usr/local/include/boost/geometry/geometries/concepts/point_concept.hpp:98:22: note: in instantiation of template class
      'boost::geometry::coordinate_type<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
    typedef typename coordinate_type<Geometry>::type ctype;
                     ^
/usr/local/include/boost/concept/detail/has_constraints.hpp:32:63: note: in instantiation of template class
      'boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
  inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
                                                              ^
/usr/local/include/boost/concept/detail/has_constraints.hpp:44:25: note: while substituting deduced template arguments into function template
      'has_constraints_' [with Model = boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >]
      , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );
                        ^
/usr/local/include/boost/config/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'
#     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
                                                                       ^
/usr/local/include/boost/mpl/if.hpp:63:68: note: in instantiation of template class
      'boost::concepts::not_satisfied<boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> > >' requested here
          BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
                                                                   ^
/usr/local/include/boost/mpl/aux_/value_wknd.hpp:57:40: note: expanded from macro 'BOOST_MPL_AUX_VALUE_WKND'
#   define BOOST_MPL_AUX_VALUE_WKND(C) C
                                       ^
/usr/local/include/boost/mpl/aux_/static_cast.hpp:24:62: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
#   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
                                                             ^
/usr/local/include/boost/concept/detail/general.hpp:51:10: note: in instantiation of template class
      'boost::mpl::if_<boost::concepts::not_satisfied<boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type> > >, boost::concepts::constraint<boost::geometry::concept::Point<boost::tuples::tuple<int, int,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >, boost::concepts::requirement<boost::concepts::failed
      ************boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >::************> >' requested here
  : mpl::if_<
         ^
/usr/local/include/boost/geometry/geometries/polygon.hpp:79:5: note: in instantiation of template class 'boost::concepts::requirement_<void
      (*)(boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >)>' requested
      here
    BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
    ^
/usr/local/include/boost/concept/assert.hpp:43:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
    BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
    ^
/usr/local/include/boost/concept/detail/general.hpp:78:25: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
    &::boost::concepts::requirement_<ModelFnPtr>::failed>    \
                        ^
bp.cpp:8:12: note: in instantiation of template class 'boost::geometry::model::polygon<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type>, true, true, std::vector, std::vector, std::allocator, std::allocator>' requested here
   polygon poly;
           ^
/usr/local/include/boost/mpl/assert.hpp:83:5: note: candidate function [with C = false] not viable: no known conversion from 'boost::mpl::failed
      ************(boost::geometry::traits::coordinate_type<int, void>::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::************)(types<int>)' to
      'typename assert<false>::type' (aka 'mpl_::assert<false>') for 1st argument
int assertion_failed( typename assert<C>::type );
    ^
In file included from bp.cpp:1:
In file included from /usr/local/include/boost/geometry.hpp:17:
In file included from /usr/local/include/boost/geometry/geometry.hpp:27:
/usr/local/include/boost/geometry/core/coordinate_system.hpp:42:5: error: no matching function for call to 'assertion_failed'
    BOOST_MPL_ASSERT_MSG
    ^~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:435:48: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
#define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
                                               ^
/usr/local/include/boost/mpl/assert.hpp:429:9: note: expanded from macro '\
BOOST_MPL_ASSERT_MSG_IMPL'
        boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:60:58: note: expanded from macro '\
BOOST_MPL_AUX_ASSERT_CONSTANT'
#   define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
                                                         ^
/usr/local/include/boost/geometry/core/coordinate_system.hpp:68:34: note: in instantiation of template class
      'boost::geometry::traits::coordinate_system<int, void>' requested here
        typedef typename traits::coordinate_system
                                 ^
/usr/local/include/boost/geometry/core/coordinate_system.hpp:61:26: note: in instantiation of template class
      'boost::geometry::core_dispatch::coordinate_system<boost::geometry::point_tag, int>' requested here
        typedef typename coordinate_system<point_tag, P>::type type;
                         ^
/usr/local/include/boost/geometry/core/coordinate_system.hpp:89:37: note: in instantiation of template class
      'boost::geometry::core_dispatch::coordinate_system<void, boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >' requested here
    typedef typename core_dispatch::coordinate_system
                                    ^
/usr/local/include/boost/geometry/geometries/concepts/point_concept.hpp:99:22: note: in instantiation of template class
      'boost::geometry::coordinate_system<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
    typedef typename coordinate_system<Geometry>::type csystem;
                     ^
/usr/local/include/boost/concept/detail/has_constraints.hpp:32:63: note: in instantiation of template class
      'boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >' requested here
  inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
                                                              ^
/usr/local/include/boost/concept/detail/has_constraints.hpp:44:25: note: while substituting deduced template arguments into function template
      'has_constraints_' [with Model = boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >]
      , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );
                        ^
/usr/local/include/boost/config/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'
#     define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
                                                                       ^
/usr/local/include/boost/mpl/if.hpp:63:68: note: in instantiation of template class
      'boost::concepts::not_satisfied<boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> > >' requested here
          BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(T1)::value)
                                                                   ^
/usr/local/include/boost/mpl/aux_/value_wknd.hpp:57:40: note: expanded from macro 'BOOST_MPL_AUX_VALUE_WKND'
#   define BOOST_MPL_AUX_VALUE_WKND(C) C
                                       ^
/usr/local/include/boost/mpl/aux_/static_cast.hpp:24:62: note: expanded from macro 'BOOST_MPL_AUX_STATIC_CAST'
#   define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast<T>(expr)
                                                             ^
/usr/local/include/boost/concept/detail/general.hpp:51:10: note: in instantiation of template class
      'boost::mpl::if_<boost::concepts::not_satisfied<boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type> > >, boost::concepts::constraint<boost::geometry::concept::Point<boost::tuples::tuple<int, int,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > >, boost::concepts::requirement<boost::concepts::failed
      ************boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type> >::************> >' requested here
  : mpl::if_<
         ^
/usr/local/include/boost/geometry/geometries/polygon.hpp:79:5: note: in instantiation of template class 'boost::concepts::requirement_<void
      (*)(boost::geometry::concept::Point<boost::tuples::tuple<int, int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> >)>' requested
      here
    BOOST_CONCEPT_ASSERT( (concept::Point<Point>) );
    ^
/usr/local/include/boost/concept/assert.hpp:43:5: note: expanded from macro 'BOOST_CONCEPT_ASSERT'
    BOOST_CONCEPT_ASSERT_FN(void(*)ModelInParens)
    ^
/usr/local/include/boost/concept/detail/general.hpp:78:25: note: expanded from macro 'BOOST_CONCEPT_ASSERT_FN'
    &::boost::concepts::requirement_<ModelFnPtr>::failed>    \
                        ^
bp.cpp:8:12: note: in instantiation of template class 'boost::geometry::model::polygon<boost::tuples::tuple<int, int, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type,
      boost::tuples::null_type, boost::tuples::null_type>, true, true, std::vector, std::vector, std::allocator, std::allocator>' requested here
   polygon poly;
           ^
/usr/local/include/boost/mpl/assert.hpp:83:5: note: candidate function [with C = false] not viable: no known conversion from 'boost::mpl::failed
      ************(boost::geometry::traits::coordinate_system<int, void>::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::************)(types<int>)' to
      'typename assert<false>::type' (aka 'mpl_::assert<false>') for 1st argument
int assertion_failed( typename assert<C>::type );
    ^
                    ^

What could be wrong?


回答1:


Your example is not complete: registration of tuples is necessary (to indicate which coordinate system you are using).

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/adapted/boost_tuple.hpp> 

BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) 

int main(int argc, char** argv)
{
   typedef boost::geometry::model::polygon<boost::tuple<int, int> > polygon;
   polygon poly;
   return 0;
}

This compiles with a couple of warnings about unused variables, but without errors.



来源:https://stackoverflow.com/questions/32639081/c-boost-geometry-error-no-matching-function-for-call-to-assertion-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!