From 7b9b04f66c66a546bd7a5fd21bfd234ec2df3d0f Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Fri, 16 Feb 2018 11:32:07 +0100 Subject: [PATCH] Bug fix when copying attributes of a cmap into another cmap, and both have no info. --- .../Combinatorial_map_copy_functors.h | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_copy_functors.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_copy_functors.h index ca3de170afb..47f240c2967 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_copy_functors.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_copy_functors.h @@ -167,7 +167,8 @@ struct Get_convert_attribute_functor } }; // **************************************************************************** -// Call a given functor if both i-attribute have an non void info +// Call a given functor if both i-attribute have an non void info, or both +// have no info. template< typename Map1, typename Map2, unsigned int i, typename Converters, bool Withinfo1=CGAL::template @@ -202,6 +203,21 @@ struct Call_functor_if_both_attributes_have_info +struct Call_functor_if_both_attributes_have_info +{ + static typename Map2::template Attribute_handle::type + run( const Map1& /*cmap1*/, + Map2& cmap2, + typename Map1::Dart_const_handle /*dh1*/, + typename Map2::Dart_handle /*dh2*/, + const Converters& /*converters*/ ) + { + return cmap2.template create_attribute(); + } +}; // **************************************************************************** // Call a given functor only if both 0-attribute have a point. // general case i!=0 or one attribute without point. @@ -258,7 +274,8 @@ struct Copy_attribute_functor_if_nonvoid // If dh2 has already an i-attribute, it was already copied. if ( cmap2.template attribute(dh2)!=Map2::null_handle ) return; - // Otherwise we copy the info if both attribute have non void info. + // Otherwise we copy the attribute if both attributes have non void info, + // or if they both have no info. typename Map2::template Attribute_handle::type res=Call_functor_if_both_attributes_have_info ::