Skip to content

Commit 7ecf7b5

Browse files
Fix MatrixView constructor when MatrixView<const T> is built from MatrixView<T> (#1044)
Co-authored-by: Silvio Traversaro <silvio.traversaro@iit.it>
1 parent a7fdef0 commit 7ecf7b5

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## [Unreleased Major]
88

9-
109
## [Unreleased]
1110

11+
## [8.0.1] - 2023-01-10
12+
13+
### Fix
14+
- Fix `MatrixView` constructor when `MatrixView<const T>` is built from `MatrixView<T>` (https://github.com/robotology/idyntree/pull/1044).
15+
1216
## [8.0.0] - 2022-12-14
1317

1418
### Added

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
cmake_minimum_required(VERSION 3.16)
1010

11-
project(iDynTree VERSION 8.0.0
11+
project(iDynTree VERSION 8.0.1
1212
LANGUAGES C CXX)
1313

1414
# Disable in source build, unless Eclipse is used

src/core/include/iDynTree/Core/MatrixView.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ namespace iDynTree
105105
template <
106106
class OtherElementType,
107107
class = std::enable_if_t<
108-
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
108+
details::is_allowed_element_type_conversion<typename MatrixView<OtherElementType>::value_type,
109+
value_type>::value>>
109110
IDYNTREE_CONSTEXPR MatrixView(const MatrixView<OtherElementType>& other)
110111
: MatrixView(other.data(), other.rows(), other.cols(), other.storageOrder())
111112
{
112113
}
113114

115+
114116
template <
115117
class Container,
116118
std::enable_if_t<std::is_const<element_type>::value
@@ -160,7 +162,9 @@ namespace iDynTree
160162
std::enable_if_t<
161163
std::is_convertible<decltype(std::declval<Container>().data()), pointer>::value
162164
&& !MatrixViewInternal::has_IsRowMajor<Container>::value
163-
&& !std::is_same<Container, MatrixView>::value,
165+
&& !std::is_same<Container, MatrixView>::value
166+
&& !std::is_same<Container,
167+
MatrixView<std::remove_pointer_t<decltype(std::declval<Container>().data())>>>::value,
164168
int> = 0>
165169
MatrixView(Container& matrix, const MatrixStorageOrdering& order = MatrixStorageOrdering::RowMajor)
166170
: MatrixView(matrix.data(), matrix.rows(), matrix.cols(), order)

0 commit comments

Comments
 (0)