Skip to content

Fix xt::drop with variables#2912

Merged
JohanMabille merged 6 commits into
xtensor-stack:masterfrom
Alex-PLACET:fix_drop_with_variables
May 12, 2026
Merged

Fix xt::drop with variables#2912
JohanMabille merged 6 commits into
xtensor-stack:masterfrom
Alex-PLACET:fix_drop_with_variables

Conversation

@Alex-PLACET
Copy link
Copy Markdown
Contributor

@Alex-PLACET Alex-PLACET commented May 6, 2026

Checklist

  • The title and commit message(s) are descriptive.
  • Small commits made to fix your PR have been squashed to avoid history pollution.
  • Tests have been added for new features or bug fixes.
  • API of new functions and classes are documented.

Description

Address #2867

Changed xtl::is_integral<T>::value to xtl::is_integral<std::decay_t<T>>::value in the drop() function template. When passing a variable like size_t index = 1, T deduces to unsigned long&, a reference type, which is_integral rejects. Decaying strips the reference so the integral branch is correctly taken.

@Alex-PLACET Alex-PLACET linked an issue May 6, 2026 that may be closed by this pull request
@Alex-PLACET Alex-PLACET marked this pull request as ready for review May 6, 2026 13:41
Comment thread include/xtensor/views/xslice.hpp Outdated
Co-authored-by: Johan Mabille <johan.mabille@gmail.com>
@Alex-PLACET Alex-PLACET requested a review from JohanMabille May 12, 2026 09:11
@JohanMabille JohanMabille merged commit a497243 into xtensor-stack:master May 12, 2026
33 of 36 checks passed
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.

Potential Regression in xt::drop

2 participants