Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update internals to use more modern c++ #1308

Closed
SteveBronder opened this issue Aug 14, 2019 · 0 comments
Closed

Update internals to use more modern c++ #1308

SteveBronder opened this issue Aug 14, 2019 · 0 comments
Assignees

Comments

@SteveBronder
Copy link
Collaborator

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

@SteveBronder SteveBronder self-assigned this Aug 14, 2019
@SteveBronder SteveBronder changed the title Use auto in multiply, subtract, and add prim functions Update internals to use more modern c++ Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant