Skip to content

Commit

Permalink
fix: Prevent Eigen assertions from breaking the build (#1085)
Browse files Browse the repository at this point in the history
These were apparently introduced in Eigen 3.4.0

Co-authored-by: Andreas Salzburger <Andreas.Salzburger@cern.ch>
  • Loading branch information
paulgessinger and asalzburger committed Nov 26, 2021
1 parent 383fdd2 commit c4c0bf6
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Tests/CommonHelpers/Acts/Tests/CommonHelpers/FloatComparisons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/test/unit_test.hpp>

#include "Acts/Definitions/Algebra.hpp"
#include "Acts/Utilities/TypeTraits.hpp"

#include <algorithm>
#include <limits>
Expand Down Expand Up @@ -154,15 +155,24 @@ predicate_result matrixCompare(const Eigen::DenseBase<Derived1>& val,
return true;
}

template <typename T>
using has_begin_t = decltype(std::declval<T>().cbegin());
template <typename T>
using has_end_t = decltype(std::declval<T>().cend());
template <typename T>
using has_eval_t = decltype(std::declval<T>().eval());

// STL container frontend
//
// FIXME: The algorithm only supports ordered containers, so the API should
// only accept them. Does someone know a clean way to do that in C++?
//
template <
typename Container,
typename CbeginDefined = decltype(*std::cbegin(std::declval<Container>())),
typename CendDefined = decltype(*std::cend(std::declval<Container>()))>
template <typename Container,
typename = std::enable_if_t<
!Acts::Concepts::exists<has_eval_t, Container> &&
Acts::Concepts::exists<has_begin_t, Container> &&
Acts::Concepts::exists<has_end_t, Container>,
int>>
predicate_result compare(const Container& val, const Container& ref,
ScalarComparison&& compareImpl) {
// Make sure that the two input containers have the same number of items
Expand Down

0 comments on commit c4c0bf6

Please sign in to comment.