Skip to content

Commit

Permalink
FIX: Add missing forward of forwarding references
Browse files Browse the repository at this point in the history
  • Loading branch information
RUrlus committed Oct 23, 2023
1 parent 2180a1b commit 936427d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions include/carma_bits/base/converters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <pybind11/pybind11.h>
#include <armadillo>
#include <carma_bits/base/numpy_converters.hpp>
#include <utility>

namespace py = pybind11;

Expand Down Expand Up @@ -51,7 +52,7 @@ auto arr_to_row(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_row(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Row<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Row<eT>>()(std::forward<decltype(arr)>(arr));
}

/*******************************************************************************
Expand Down Expand Up @@ -98,7 +99,7 @@ auto arr_to_col(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_col(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Col<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Col<eT>>()(std::forward<decltype(arr)>(arr));
}

/*******************************************************************************
Expand Down Expand Up @@ -145,7 +146,7 @@ auto arr_to_mat(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_mat(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Mat<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Mat<eT>>()(std::forward<decltype(arr)>(arr));
}
/*******************************************************************************
* ARR_TO_CUBE *
Expand Down Expand Up @@ -191,6 +192,6 @@ auto arr_to_cube(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_cube(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Cube<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Cube<eT>>()(std::forward<decltype(arr)>(arr));
}
} // namespace carma
8 changes: 4 additions & 4 deletions include/carma_bits/extension/converters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ auto arr_to_row(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_row(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Row<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Row<eT>>()(std::forward<decltype(arr)>(arr));
}

/**
Expand Down Expand Up @@ -224,7 +224,7 @@ auto arr_to_col(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_col(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Col<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Col<eT>>()(std::forward<decltype(arr)>(arr));
}

/**
Expand Down Expand Up @@ -286,7 +286,7 @@ auto arr_to_mat(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_mat(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Mat<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Mat<eT>>()(std::forward<decltype(arr)>(arr));
}

/**
Expand Down Expand Up @@ -348,7 +348,7 @@ auto arr_to_cube(const py::array_t<eT>& arr) {
*/
template <typename eT>
auto arr_to_cube(py::array_t<eT>&& arr) {
return internal::DefaultNumpyConverter<arma::Cube<eT>>()(arr);
return internal::DefaultNumpyConverter<arma::Cube<eT>>()(std::forward<decltype(arr)>(arr));
}

/**
Expand Down

0 comments on commit 936427d

Please sign in to comment.