mirror of https://github.com/CGAL/cgal
Merge pull request #2508 from afabri/Property_map-fix_Dynamic_property_map-GF
Property_map: Fix put(Dynamic_property_map,..)
This commit is contained in:
commit
31804d3c0e
61
.travis.yml
61
.travis.yml
|
|
@ -9,41 +9,46 @@ env:
|
|||
- PACKAGE='Alpha_shapes_2 Alpha_shapes_3 Apollonius_graph_2 '
|
||||
- PACKAGE='Arithmetic_kernel Arrangement_on_surface_2 Barycentric_coordinates_2 '
|
||||
- PACKAGE='BGL Boolean_set_operations_2 Bounding_volumes '
|
||||
- PACKAGE='Box_intersection_d CGAL_ImageIO CGAL_ipelets '
|
||||
- PACKAGE='Circular_kernel_2 Circular_kernel_3 Circulator '
|
||||
- PACKAGE='Classification Combinatorial_map Cone_spanners_2 '
|
||||
- PACKAGE='Convex_decomposition_3 Convex_hull_2 Convex_hull_3 '
|
||||
- PACKAGE='Convex_hull_d Distance_2 Distance_3 '
|
||||
- PACKAGE='Envelope_2 Envelope_3 Filtered_kernel '
|
||||
- PACKAGE='Generalized_map Generator Geomview '
|
||||
- PACKAGE='GraphicsView HalfedgeDS Hash_map '
|
||||
- PACKAGE='Box_intersection_d Cartesian_kernel CGAL_Core '
|
||||
- PACKAGE='CGAL_ImageIO CGAL_ipelets Circular_kernel_2 '
|
||||
- PACKAGE='Circular_kernel_3 Circulator Classification '
|
||||
- PACKAGE='Combinatorial_map Cone_spanners_2 Convex_decomposition_3 '
|
||||
- PACKAGE='Convex_hull_2 Convex_hull_3 Convex_hull_d '
|
||||
- PACKAGE='Distance_2 Distance_3 Envelope_2 '
|
||||
- PACKAGE='Envelope_3 Filtered_kernel Generalized_map '
|
||||
- PACKAGE='Generator Geomview GraphicsView '
|
||||
- PACKAGE='HalfedgeDS Hash_map Homogeneous_kernel '
|
||||
- PACKAGE='Inscribed_areas Installation Interpolation '
|
||||
- PACKAGE='Intersections_2 Intersections_3 Interval_skip_list '
|
||||
- PACKAGE='Interval_support Inventor Jet_fitting_3 '
|
||||
- PACKAGE='Kernel_23 Kernel_d Kinetic_data_structures '
|
||||
- PACKAGE='Kinetic_framework Linear_cell_complex Matrix_search '
|
||||
- PACKAGE='Mesh_2 Mesh_3 Minkowski_sum_2 '
|
||||
- PACKAGE='Minkowski_sum_3 Modifier Modular_arithmetic '
|
||||
- PACKAGE='Nef_2 Nef_3 Nef_S2 '
|
||||
- PACKAGE='NewKernel_d Number_types Optimal_transportation_reconstruction_2 '
|
||||
- PACKAGE='Partition_2 Periodic_2_triangulation_2 Periodic_3_triangulation_3 '
|
||||
- PACKAGE='Point_set_2 Point_set_3 Point_set_processing_3 '
|
||||
- PACKAGE='Point_set_shape_detection_3 Poisson_surface_reconstruction_3 Polygon '
|
||||
- PACKAGE='Polygon_mesh_processing Polyhedron Polyhedron_IO '
|
||||
- PACKAGE='Polyline_simplification_2 Polynomial Polytope_distance_d '
|
||||
- PACKAGE='Principal_component_analysis Profiling_tools QP_solver '
|
||||
- PACKAGE='Kinetic_framework LEDA Linear_cell_complex '
|
||||
- PACKAGE='MacOSX Maintenance Matrix_search '
|
||||
- PACKAGE='Mesh_2 Mesh_3 Mesher_level '
|
||||
- PACKAGE='Minkowski_sum_2 Minkowski_sum_3 Modifier '
|
||||
- PACKAGE='Modular_arithmetic Nef_2 Nef_3 '
|
||||
- PACKAGE='Nef_S2 NewKernel_d Number_types '
|
||||
- PACKAGE='OpenNL Operations_on_polyhedra Optimal_transportation_reconstruction_2 '
|
||||
- PACKAGE='Optimisation_basic Partition_2 Periodic_2_triangulation_2 '
|
||||
- PACKAGE='Periodic_3_triangulation_3 Point_set_2 Point_set_3 '
|
||||
- PACKAGE='Point_set_processing_3 Point_set_shape_detection_3 Poisson_surface_reconstruction_3 '
|
||||
- PACKAGE='Polygon Polygon_mesh_processing Polyhedron '
|
||||
- PACKAGE='Polyhedron_IO Polyline_simplification_2 Polynomial '
|
||||
- PACKAGE='Polytope_distance_d Principal_component_analysis Principal_component_analysis_LGPL '
|
||||
- PACKAGE='Profiling_tools Property_map QP_solver '
|
||||
- PACKAGE='Random_numbers Ridges_3 Scale_space_reconstruction_3 '
|
||||
- PACKAGE='Segment_Delaunay_graph_2 Segment_Delaunay_graph_Linf_2 Set_movable_separability_2 '
|
||||
- PACKAGE='Skin_surface_3 Snap_rounding_2 Solver_interface '
|
||||
- PACKAGE='Spatial_searching Spatial_sorting STL_Extension '
|
||||
- PACKAGE='Straight_skeleton_2 Stream_lines_2 Stream_support '
|
||||
- PACKAGE='Subdivision_method_3 Surface_mesh Surface_mesh_deformation '
|
||||
- PACKAGE='Surface_mesher Surface_mesh_parameterization Surface_mesh_segmentation '
|
||||
- PACKAGE='Surface_mesh_shortest_path Surface_mesh_simplification Surface_mesh_skeletonization '
|
||||
- PACKAGE='Sweep_line_2 TDS_2 TDS_3 '
|
||||
- PACKAGE='Scripts SearchStructures Segment_Delaunay_graph_2 '
|
||||
- PACKAGE='Segment_Delaunay_graph_Linf_2 Set_movable_separability_2 Skin_surface_3 '
|
||||
- PACKAGE='Snap_rounding_2 Solver_interface Spatial_searching '
|
||||
- PACKAGE='Spatial_sorting STL_Extension Straight_skeleton_2 '
|
||||
- PACKAGE='Stream_lines_2 Stream_support Subdivision_method_3 '
|
||||
- PACKAGE='Surface_mesh Surface_mesh_deformation Surface_mesh_parameterization '
|
||||
- PACKAGE='Surface_mesh_segmentation Surface_mesh_shortest_path Surface_mesh_simplification '
|
||||
- PACKAGE='Surface_mesh_skeletonization Surface_mesher Sweep_line_2 '
|
||||
- PACKAGE='TDS_2 TDS_3 Testsuite '
|
||||
- PACKAGE='Three Triangulation Triangulation_2 '
|
||||
- PACKAGE='Triangulation_3 Union_find Visibility_2 '
|
||||
- PACKAGE='Voronoi_diagram_2 '
|
||||
- PACKAGE='Voronoi_diagram_2 wininst '
|
||||
- PACKAGE='Polyhedron_demo'
|
||||
compiler:
|
||||
- clang-3.6
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ do
|
|||
cd ..
|
||||
for f in *
|
||||
do
|
||||
if [ -d "$f/examples/$f" ] || [ -d "$f/test/$f" ] || [ -d "$f/demo/$f" ]
|
||||
if [ -d "$f/package_info/$f" ]
|
||||
then
|
||||
PACKAGES+="$f "
|
||||
fi
|
||||
|
|
@ -87,6 +87,7 @@ do
|
|||
then
|
||||
echo "The matrix and the actual package list differ : ."
|
||||
echo ${DIFFERENCE[*]}
|
||||
echo "You should run generate_travis.sh."
|
||||
exit 1
|
||||
fi
|
||||
echo "Matrix is up to date."
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ INDEX=0
|
|||
i=0
|
||||
for f in *
|
||||
do
|
||||
if [ -d "$f/examples/$f" ] || [ -d "$f/test/$f" ] || [ -d "$f/demo/$f" ]
|
||||
if [ -d "$f/package_info/$f" ]
|
||||
then
|
||||
PACKAGES[$INDEX]+="$f "
|
||||
i=$[i+1]
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ BGL
|
|||
Boolean_set_operations_2
|
||||
Bounding_volumes
|
||||
Box_intersection_d
|
||||
Cartesian_kernel
|
||||
CGAL_Core
|
||||
CGAL_ImageIO
|
||||
CGAL_ipelets
|
||||
Circular_kernel_2
|
||||
|
|
@ -37,6 +39,7 @@ Geomview
|
|||
GraphicsView
|
||||
HalfedgeDS
|
||||
Hash_map
|
||||
Homogeneous_kernel
|
||||
Inscribed_areas
|
||||
Installation
|
||||
Interpolation
|
||||
|
|
@ -50,10 +53,14 @@ Kernel_23
|
|||
Kernel_d
|
||||
Kinetic_data_structures
|
||||
Kinetic_framework
|
||||
LEDA
|
||||
Linear_cell_complex
|
||||
MacOSX
|
||||
Maintenance
|
||||
Matrix_search
|
||||
Mesh_2
|
||||
Mesh_3
|
||||
Mesher_level
|
||||
Minkowski_sum_2
|
||||
Minkowski_sum_3
|
||||
Modifier
|
||||
|
|
@ -63,7 +70,10 @@ Nef_3
|
|||
Nef_S2
|
||||
NewKernel_d
|
||||
Number_types
|
||||
OpenNL
|
||||
Operations_on_polyhedra
|
||||
Optimal_transportation_reconstruction_2
|
||||
Optimisation_basic
|
||||
Partition_2
|
||||
Periodic_2_triangulation_2
|
||||
Periodic_3_triangulation_3
|
||||
|
|
@ -80,11 +90,15 @@ Polyline_simplification_2
|
|||
Polynomial
|
||||
Polytope_distance_d
|
||||
Principal_component_analysis
|
||||
Principal_component_analysis_LGPL
|
||||
Profiling_tools
|
||||
Property_map
|
||||
QP_solver
|
||||
Random_numbers
|
||||
Ridges_3
|
||||
Scale_space_reconstruction_3
|
||||
Scripts
|
||||
SearchStructures
|
||||
Segment_Delaunay_graph_2
|
||||
Segment_Delaunay_graph_Linf_2
|
||||
Set_movable_separability_2
|
||||
|
|
@ -100,15 +114,16 @@ Stream_support
|
|||
Subdivision_method_3
|
||||
Surface_mesh
|
||||
Surface_mesh_deformation
|
||||
Surface_mesher
|
||||
Surface_mesh_parameterization
|
||||
Surface_mesh_segmentation
|
||||
Surface_mesh_shortest_path
|
||||
Surface_mesh_simplification
|
||||
Surface_mesh_skeletonization
|
||||
Surface_mesher
|
||||
Sweep_line_2
|
||||
TDS_2
|
||||
TDS_3
|
||||
Testsuite
|
||||
Three
|
||||
Triangulation
|
||||
Triangulation_2
|
||||
|
|
@ -116,3 +131,4 @@ Triangulation_3
|
|||
Union_find
|
||||
Visibility_2
|
||||
Voronoi_diagram_2
|
||||
wininst
|
||||
|
|
|
|||
|
|
@ -50,22 +50,20 @@ struct Dynamic_property_map {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
friend reference get(const Dynamic_property_map& m, const key_type& k)
|
||||
{
|
||||
typename Map::const_iterator it = m.map_->find(k);
|
||||
if(it == m.map_->end()){
|
||||
(*(const_cast<Dynamic_property_map&>(m).map_))[k] = m.default_value();
|
||||
return m.default_value();
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
||||
|
||||
friend void put(Dynamic_property_map& m, const key_type& k, const value_type& v)
|
||||
friend void put(const Dynamic_property_map& m, const key_type& k, const value_type& v)
|
||||
{
|
||||
if(v != m.default_value()){
|
||||
(*(m.map_))[k] = v;
|
||||
}
|
||||
(*(m.map_))[k] = v;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -192,7 +190,7 @@ add_property(face_property_t<T> prop, const G&)
|
|||
return internal::Dynamic_property_map<face_descriptor,T>(prop.t);
|
||||
}
|
||||
|
||||
template<class G, class T, typename Descriptor>
|
||||
template<typename G, typename Descriptor, typename T>
|
||||
void remove_property(
|
||||
internal::Dynamic_property_map<Descriptor, T> pm,
|
||||
const G&)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
# Created by the script cgal_create_CMakeLists
|
||||
# This is the CMake script for compiling a set of CGAL applications.
|
||||
|
||||
project( Property_map_Tests )
|
||||
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.11)
|
||||
|
||||
# CGAL and its components
|
||||
find_package( CGAL QUIET COMPONENTS )
|
||||
|
||||
if ( NOT CGAL_FOUND )
|
||||
|
||||
message(STATUS "This project requires the CGAL library, and will not be compiled.")
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
# include helper file
|
||||
include( ${CGAL_USE_FILE} )
|
||||
|
||||
|
||||
# Boost and its components
|
||||
find_package( Boost REQUIRED )
|
||||
|
||||
if ( NOT Boost_FOUND )
|
||||
|
||||
message(STATUS "This project requires the Boost library, and will not be compiled.")
|
||||
|
||||
return()
|
||||
|
||||
endif()
|
||||
|
||||
# include for local directory
|
||||
|
||||
# include for local package
|
||||
include_directories( BEFORE ../../include )
|
||||
|
||||
|
||||
# Creating entries for all C++ files with "main" routine
|
||||
# ##########################################################
|
||||
|
||||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
create_single_source_cgal_program( "dynamic_property_map.cpp" )
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
#include <CGAL/Dynamic_property_map.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
CGAL::internal::Dynamic_property_map<int,int> dpm(2);
|
||||
assert(dpm.default_value() == 2);
|
||||
|
||||
assert(get(dpm, 0) == 2);
|
||||
put(dpm, 0, 1);
|
||||
assert(get(dpm, 0) == 1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue