用CGAL 4.12-beta 2警告C4503

时间:2018-04-20 15:48:18

标签: c++ visual-studio-2012 cgal

我从warning C4503移到CGAL 4.4后,我的代码开始生成CGAL 4.12-beta 2。我在Windows 7操作系统上使用Visual Studio 2012。 根据编译器,以下声明是有问题的代码。

struct pairA
{
    int A1;
    int A2;
    pairA():A1(int()),A2(int()){}
};
struct pairB
{
    int B1;
    IdType B2;
    pairB():B1(int()),B2(IdType()){}
};
struct pairInfo
{
    pairA pA;
    pairB pB;

};
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Triangulation_vertex_base_with_info_2<pairInfo, Kernel > Vertex_base; //<0 - boundary , -1 not associated, >0 associated with edge>
typedef CGAL::Delaunay_mesh_face_base_2< Kernel > Face_base;
//typedef CGAL::Triangulation_face_base_with_info_2<std::pair<int,int>, Kernel> Face_base;  //does not work with constrained triangulation?
typedef CGAL::Exact_predicates_tag    Itag;
typedef CGAL::Triangulation_data_structure_2<  Vertex_base, Face_base > Triangulation_data;
typedef CGAL::Constrained_Delaunay_triangulation_2< Kernel, Triangulation_data, Itag > CDTriangulation;
typedef CGAL::Constrained_triangulation_plus_2<CDTriangulation>    CDTriangulationPlus;
typedef CGAL::Delaunay_mesh_size_criteria_2< CDTriangulationPlus > Criteria;
typedef CGAL::Delaunay_mesher_2< CDTriangulationPlus, Criteria > Mesher_Base;
typedef CDTriangulationPlus::Vertex_handle Vertex_handle;
typedef std::vector< Vertex_handle > Vertex_handles;
typedef CDTriangulationPlus::Face_handle Face_handle;
typedef CDTriangulationPlus::Point Point;
typedef CGAL::Polygon_2<Kernel> Polygon2D;

我根据网络上的建议定义了pairInof而不是嵌套std::pair,但这似乎并没有消除这个问题。

以下是我收到的警告信息

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(120): error C2220: warning treated as error - no 'object' file generated
10>          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(118) : while compiling class template member function 'std::map<_Kty,_Ty,_Pr>::map(const CGAL::Polyline_constraint_hierarchy_2<T,Compare,Data>::Pair_compare &)'
10>          with
10>          [
10>              _Kty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>>,
10>              _Ty=std::list<CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Context> *,
10>              _Pr=CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Pair_compare,
10>              T=CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,
10>              Compare=CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,
10>              Data=CGAL::Point_2<CGAL::Epick>
10>          ]
10>          D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Polyline_constraint_hierarchy_2.h(204) : see reference to function template instantiation 'std::map<_Kty,_Ty,_Pr>::map(const CGAL::Polyline_constraint_hierarchy_2<T,Compare,Data>::Pair_compare &)' being compiled
10>          with
10>          [
10>              _Kty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>>,
10>              _Ty=std::list<CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Context> *,
10>              _Pr=CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Pair_compare,
10>              T=CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,
10>              Compare=CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,
10>              Data=CGAL::Point_2<CGAL::Epick>
10>          ]
10>          D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Polyline_constraint_hierarchy_2.h(187) : see reference to class template instantiation 'std::map<_Kty,_Ty,_Pr>' being compiled
10>          with
10>          [
10>              _Kty=std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>>,
10>              _Ty=std::list<CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Context> *,
10>              _Pr=CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Pair_compare
10>          ]
10>          D:\PE\PE_Software\3rdParty\CGAL\CGAL-4.12-beta2\include\CGAL/Constrained_triangulation_plus_2.h(171) : see reference to class template instantiation 'CGAL::Polyline_constraint_hierarchy_2<T,Compare,Data>' being compiled
10>          with
10>          [
10>              T=CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,
10>              Compare=CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,
10>              Data=CGAL::Point_2<CGAL::Epick>
10>          ]
10>          src\ExtPP.cpp(481) : see reference to class template instantiation 'CGAL::Constrained_triangulation_plus_2<Tr_>' being compiled
10>          with
10>          [
10>              Tr_=CDTriangulation
10>          ]
10>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(120): warning C4503: 'std::_Allocator_base<_Ty>' : decorated name length exceeded, name was truncated
10>          with
10>          [
10>              _Ty=std::pair<const std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>>,std::list<CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Context> *>
10>          ]
10>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\map(120): warning C4503: 'std::allocator<_Ty>' : decorated name length exceeded, name was truncated
10>          with
10>          [
10>              _Ty=std::pair<const std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>>,std::list<CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Context> *>
10>          ]
10>C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\xtree(2216): warning C4503: 'std::_Tree_unchecked_const_iterator<_Mytree,_Base>' : decorated name length exceeded, name was truncated
10>          with
10>          [
10>              _Mytree=std::_Tree_val<std::_Tree_simple_types<std::pair<const std::pair<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>>,std::list<CGAL::Polyline_constraint_hierarchy_2<CGAL::internal::CC_iterator<CGAL::Compact_container<CGAL::Triangulation_vertex_base_with_info_2<ExtPP::CGALMesh::pairInfo,Kernel,CGAL::Triangulation_vertex_base_2<CGAL::Exact_predicates_inexact_constructions_kernel,CGAL::Triangulation_ds_vertex_base_2<CGAL::Triangulation_data_structure_2<Vertex_base,Face_base>>>>>,false>,CGAL::Pct2_vertex_handle_less_xy<CGAL::Constrained_triangulation_plus_2<CDTriangulation>>,CGAL::Point_2<CGAL::Epick>>::Context> *>>>,
10>              _Base=std::_Iterator_base
10>          ]
10>   

有没有办法通过更正代码来消除此警告?

1 个答案:

答案 0 :(得分:0)

您是否尝试过微软推荐的解决方案?

W4503

问题看起来很清楚,也解决了问题。

按照他们的建议将您的typedef封装在Struct中