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

[WIP] Try to fix const iterating #380

Closed
wants to merge 1 commit into from

Conversation

Randl
Copy link
Contributor

@Randl Randl commented Aug 11, 2017

Added test to indicate the problem, attempted to fix.
@SylvainCorlay @JohanMabille ideas?

@SylvainCorlay
Copy link
Member

The error that you are getting is that since the view is not const, it is calling the non-const overload of the function.

I have not tried yet, but I think that this example should build correctly if the returned type of view has type const xview instead of xview.

@SylvainCorlay
Copy link
Member

SylvainCorlay commented Aug 11, 2017

At first glance, a solution might be to change https://github.com/QuantStack/xtensor/blob/master/include/xtensor/xview.hpp#L735 so that view type is a const xview when E is const.

E.g. using a std::conditional_t with std::is_const.

@SylvainCorlay
Copy link
Member

cc @JohanMabille

@SylvainCorlay SylvainCorlay mentioned this pull request Aug 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants