diff --git a/GeoLib/MinimalBoundingSphere.cpp b/GeoLib/MinimalBoundingSphere.cpp index 7c61cc003690ffd9a053014754686d401ac91c5e..da7758fbafde1a5b6a84574929f836d323c71ce9 100644 --- a/GeoLib/MinimalBoundingSphere.cpp +++ b/GeoLib/MinimalBoundingSphere.cpp @@ -165,12 +165,13 @@ MinimalBoundingSphere::recurseCalculation( { if (i>start_idx) { - MathLib::Point3d* tmp = sphere_points[start_idx+i]; using DiffType = std::vector<MathLib::Point3d*>::iterator::difference_type; - std::copy(sphere_points.begin()+static_cast<DiffType>(start_idx), - sphere_points.begin()+static_cast<DiffType>(start_idx + i), - sphere_points.begin()+static_cast<DiffType>(start_idx + 1)); - sphere_points[start_idx] = tmp; + std::vector<MathLib::Point3d*> const tmp_ps( + sphere_points.cbegin() + static_cast<DiffType>(start_idx), + sphere_points.cbegin() + static_cast<DiffType>(start_idx + i + 1)); + std::copy(tmp_ps.cbegin(), --tmp_ps.cend(), + sphere_points.begin() + static_cast<DiffType>(start_idx + 1)); + sphere_points[start_idx] = tmp_ps.back(); } sphere = recurseCalculation(sphere_points, start_idx+1, i, n_boundary_points+1); } diff --git a/GeoLib/MinimalBoundingSphere.h b/GeoLib/MinimalBoundingSphere.h index 3d86fed4af2722e8117f3df5b96712641e0e6971..b27b6a7422bc39f124de5f1db85df4f893f22025 100644 --- a/GeoLib/MinimalBoundingSphere.h +++ b/GeoLib/MinimalBoundingSphere.h @@ -30,8 +30,6 @@ namespace GeoLib class MinimalBoundingSphere { public: - /// Copy constructor - MinimalBoundingSphere(MinimalBoundingSphere const&) = default; /// Point-Sphere MinimalBoundingSphere(MathLib::Point3d const& p, double radius = std::numeric_limits<double>::epsilon()); /// Bounding sphere using two points @@ -46,7 +44,6 @@ public: MathLib::Point3d const& s); /// Bounding sphere of n points MinimalBoundingSphere(std::vector<MathLib::Point3d*> const& points); - ~MinimalBoundingSphere() {} /// Returns the center point of the sphere MathLib::Point3d getCenter() const { return MathLib::Point3d(_center.getCoords()); } diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index 6be6902ce568c1e835bce49aeb60f60b634a1e4a..20f5738a7a1b475b88229276db98ead1e5284e37 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -38,6 +38,9 @@ if(COMPILER_IS_GCC) if(NOT APPLE AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") endif() + else() + # Enable assertions in STL in debug mode. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated -Wall -Wextra") endif() # COMPILER_IS_GCC @@ -48,6 +51,10 @@ if(COMPILER_IS_CLANG) message(FATAL_ERROR "Aborting: Clang 3.3 is required! Found version ${CMAKE_CXX_COMPILER_VERSION}") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-c++98-compat-pedantic") + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # Enable assertions in STL in debug mode. + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_ASSERT -D_GLIBCXX_DEBUG_PEDASSERT -D_GLIBCXX_DEBUG_VERIFY") + endif() endif() # COMPILER_IS_CLANG ### Intel compiler