Skip to content
Snippets Groups Projects
Commit 67416c6a authored by Lars Bilke's avatar Lars Bilke
Browse files

Merge pull request #613 from endJunction/StlAssertsGccClang

Enable STL assertions for Debug builds with gcc/clang.
parents b2315e0b 8024b6d0
No related branches found
No related tags found
No related merge requests found
...@@ -165,12 +165,13 @@ MinimalBoundingSphere::recurseCalculation( ...@@ -165,12 +165,13 @@ MinimalBoundingSphere::recurseCalculation(
{ {
if (i>start_idx) if (i>start_idx)
{ {
MathLib::Point3d* tmp = sphere_points[start_idx+i];
using DiffType = std::vector<MathLib::Point3d*>::iterator::difference_type; using DiffType = std::vector<MathLib::Point3d*>::iterator::difference_type;
std::copy(sphere_points.begin()+static_cast<DiffType>(start_idx), std::vector<MathLib::Point3d*> const tmp_ps(
sphere_points.begin()+static_cast<DiffType>(start_idx + i), sphere_points.cbegin() + static_cast<DiffType>(start_idx),
sphere_points.begin()+static_cast<DiffType>(start_idx + 1)); sphere_points.cbegin() + static_cast<DiffType>(start_idx + i + 1));
sphere_points[start_idx] = tmp; 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); sphere = recurseCalculation(sphere_points, start_idx+1, i, n_boundary_points+1);
} }
......
...@@ -30,8 +30,6 @@ namespace GeoLib ...@@ -30,8 +30,6 @@ namespace GeoLib
class MinimalBoundingSphere class MinimalBoundingSphere
{ {
public: public:
/// Copy constructor
MinimalBoundingSphere(MinimalBoundingSphere const&) = default;
/// Point-Sphere /// Point-Sphere
MinimalBoundingSphere(MathLib::Point3d const& p, double radius = std::numeric_limits<double>::epsilon()); MinimalBoundingSphere(MathLib::Point3d const& p, double radius = std::numeric_limits<double>::epsilon());
/// Bounding sphere using two points /// Bounding sphere using two points
...@@ -46,7 +44,6 @@ public: ...@@ -46,7 +44,6 @@ public:
MathLib::Point3d const& s); MathLib::Point3d const& s);
/// Bounding sphere of n points /// Bounding sphere of n points
MinimalBoundingSphere(std::vector<MathLib::Point3d*> const& points); MinimalBoundingSphere(std::vector<MathLib::Point3d*> const& points);
~MinimalBoundingSphere() {}
/// Returns the center point of the sphere /// Returns the center point of the sphere
MathLib::Point3d getCenter() const { return MathLib::Point3d(_center.getCoords()); } MathLib::Point3d getCenter() const { return MathLib::Point3d(_center.getCoords()); }
......
...@@ -38,6 +38,9 @@ if(COMPILER_IS_GCC) ...@@ -38,6 +38,9 @@ if(COMPILER_IS_GCC)
if(NOT APPLE AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja") if(NOT APPLE AND NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif() 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() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated -Wall -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-deprecated -Wall -Wextra")
endif() # COMPILER_IS_GCC endif() # COMPILER_IS_GCC
...@@ -48,6 +51,10 @@ if(COMPILER_IS_CLANG) ...@@ -48,6 +51,10 @@ if(COMPILER_IS_CLANG)
message(FATAL_ERROR "Aborting: Clang 3.3 is required! Found version ${CMAKE_CXX_COMPILER_VERSION}") message(FATAL_ERROR "Aborting: Clang 3.3 is required! Found version ${CMAKE_CXX_COMPILER_VERSION}")
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-c++98-compat-pedantic") 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 endif() # COMPILER_IS_CLANG
### Intel compiler ### Intel compiler
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment