Skip to content

Commit e93e1a7

Browse files
authored
Merge pull request #488 from sloretz/sfinae_NumpyEquivalentType
Fix error: redefinition of ‘struct eigenpy::NumpyEquivalentType<...
2 parents 4904470 + ad82346 commit e93e1a7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1111

1212
### Fixed
1313
- Remove CMake CMP0167 warnings ([#487](https://github.com/stack-of-tasks/eigenpy/pull/487))
14+
- Fix compilation error on armhf ([#488](https://github.com/stack-of-tasks/eigenpy/pull/488))
1415

1516
## [3.7.0] - 2024-06-11
1617

include/eigenpy/numpy.hpp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void EIGENPY_DLLAPI import_numpy();
5555
int EIGENPY_DLLAPI PyArray_TypeNum(PyTypeObject* type);
5656

5757
// By default, the Scalar is considered as a Python object
58-
template <typename Scalar>
58+
template <typename Scalar, typename Enable = void>
5959
struct NumpyEquivalentType {
6060
enum { type_code = NPY_USERDEF };
6161
};
@@ -139,12 +139,19 @@ struct NumpyEquivalentType<unsigned long> {
139139
// See https://github.com/stack-of-tasks/eigenpy/pull/455
140140
#if defined __linux__
141141

142-
template <>
143-
struct NumpyEquivalentType<long long> {
142+
#include <type_traits>
143+
144+
template <typename Scalar>
145+
struct NumpyEquivalentType<
146+
Scalar, std::enable_if_t<!std::is_same<int64_t, long long>::value &&
147+
std::is_same<Scalar, long long>::value> > {
144148
enum { type_code = NPY_LONGLONG };
145149
};
146-
template <>
147-
struct NumpyEquivalentType<unsigned long long> {
150+
template <typename Scalar>
151+
struct NumpyEquivalentType<
152+
Scalar,
153+
std::enable_if_t<!std::is_same<uint64_t, unsigned long long>::value &&
154+
std::is_same<Scalar, unsigned long long>::value> > {
148155
enum { type_code = NPY_ULONGLONG };
149156
};
150157

0 commit comments

Comments
 (0)