Skip to content

Commit

Permalink
Fix MatrixView constructor when MatrixView<const T> is built from Mat…
Browse files Browse the repository at this point in the history
…rixView<T> (#1044)

Co-authored-by: Silvio Traversaro <silvio.traversaro@iit.it>
  • Loading branch information
GiulioRomualdi and traversaro authored Jan 10, 2023
1 parent a7fdef0 commit 7ecf7b5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased Major]


## [Unreleased]

## [8.0.1] - 2023-01-10

### Fix
- Fix `MatrixView` constructor when `MatrixView<const T>` is built from `MatrixView<T>` (https://github.com/robotology/idyntree/pull/1044).

## [8.0.0] - 2022-12-14

### Added
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

cmake_minimum_required(VERSION 3.16)

project(iDynTree VERSION 8.0.0
project(iDynTree VERSION 8.0.1
LANGUAGES C CXX)

# Disable in source build, unless Eclipse is used
Expand Down
8 changes: 6 additions & 2 deletions src/core/include/iDynTree/Core/MatrixView.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,14 @@ namespace iDynTree
template <
class OtherElementType,
class = std::enable_if_t<
details::is_allowed_element_type_conversion<OtherElementType, element_type>::value>>
details::is_allowed_element_type_conversion<typename MatrixView<OtherElementType>::value_type,
value_type>::value>>
IDYNTREE_CONSTEXPR MatrixView(const MatrixView<OtherElementType>& other)
: MatrixView(other.data(), other.rows(), other.cols(), other.storageOrder())
{
}


template <
class Container,
std::enable_if_t<std::is_const<element_type>::value
Expand Down Expand Up @@ -160,7 +162,9 @@ namespace iDynTree
std::enable_if_t<
std::is_convertible<decltype(std::declval<Container>().data()), pointer>::value
&& !MatrixViewInternal::has_IsRowMajor<Container>::value
&& !std::is_same<Container, MatrixView>::value,
&& !std::is_same<Container, MatrixView>::value
&& !std::is_same<Container,
MatrixView<std::remove_pointer_t<decltype(std::declval<Container>().data())>>>::value,
int> = 0>
MatrixView(Container& matrix, const MatrixStorageOrdering& order = MatrixStorageOrdering::RowMajor)
: MatrixView(matrix.data(), matrix.rows(), matrix.cols(), order)
Expand Down

0 comments on commit 7ecf7b5

Please sign in to comment.