Skip to content

Enhance xmasked_view support for output streaming#2899

Merged
JohanMabille merged 2 commits into
xtensor-stack:masterfrom
Alex-PLACET:masked-view-stream-output
May 11, 2026
Merged

Enhance xmasked_view support for output streaming#2899
JohanMabille merged 2 commits into
xtensor-stack:masterfrom
Alex-PLACET:masked-view-stream-output

Conversation

@Alex-PLACET
Copy link
Copy Markdown
Contributor

@Alex-PLACET Alex-PLACET commented Apr 29, 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

Fix xt::masked_view pretty-printing when the underlying data is non-optional.
Related to: #2495

The generic non-fundamental printer was streaming masked proxy values directly, which could lose the correct masked/value state during formatting. This change keeps the existing generic printer path but handles xtl::xmasked_value with a compile-time branch and streams a stabilized value via unary +.

Changes

  • include xtl/xmasked_value_meta.hpp in xio.hpp
  • update the generic non-fundamental printer to use if constexpr
  • stream masked values with buf << +val
  • add a regression test for masked_view stream output on plain xarray data

@Alex-PLACET Alex-PLACET marked this pull request as ready for review April 29, 2026 07:28
@JohanMabille JohanMabille merged commit 961722d into xtensor-stack:master May 11, 2026
21 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.

2 participants