Commit 961722d
authored
Enhance xmasked_view support for output streaming (#2899)
# Checklist
- [x] The title and commit message(s) are descriptive.
- [x] Small commits made to fix your PR have been squashed to avoid
history pollution.
- [x] Tests have been added for new features or bug fixes.
- [x] 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
---------
Co-authored-by: Alexis Placet <2400067+Alex-PLACET@users.noreply.github.com>1 parent 8adbd1c commit 961722d
2 files changed
Lines changed: 26 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
646 | 647 | | |
647 | 648 | | |
648 | 649 | | |
649 | | - | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
650 | 658 | | |
651 | 659 | | |
652 | 660 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
10 | 12 | | |
11 | 13 | | |
12 | 14 | | |
| |||
210 | 212 | | |
211 | 213 | | |
212 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
213 | 230 | | |
214 | 231 | | |
215 | 232 | | |
| |||
0 commit comments