Skip to content

Update internals to use more modern c++ #1308

@SteveBronder

Description

@SteveBronder

Description

As described in this discourse thread I think we can get away with using auto in the return types for simple functions like add, subtract, and multiply.

Example

Instead of a function signature such as

template <typename T1, typename T2, int R, int C>
inline Eigen::Matrix<return_type_t<T1, T2>, R, C> add(
    const Eigen::Matrix<T1, R, C>& m1, const Eigen::Matrix<T2, R, C>& m2) {

We now use

template <typename Mat1, typename Mat2, typename = enable_if_all_eigen<Mat1, Mat2>>
inline auto add(const Mat1& m1, const Mat2& m2) {

This is nice because enable_if_all_eigen checks that the template type inherits from Eigen::Base, which means that Mat1 and Mat2 can be types like Eigen::Product<...> or Eigen::Diagonal<...>

Expected Output

Output should all stay the same

Current Version:

v2.20.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions