• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bemanproject / utf_view / 43945917042
100%

Build:
DEFAULT BRANCH: main
Ran 16 Nov 2026 08:07PM UTC
Jobs 1
Files 5
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 Nov 2026 08:04PM UTC coverage: 99.775% (+0.001%) from 99.774%
43945917042

push

github

ednolan
Replace success_ data member by making buf_ std::expected

This refactor comes out of an attempt to simplify the operator++ of
the iterator.

Previously we had separate overloads for replacement mode and expected
mode:

```
  constexpr @*iterator*@& operator++() requires (K == to_utf_view_kind::expected)
  {
    if (!@*success*@()) {
      if constexpr (is_same_v<charT, char8_t>) {
        @*advance-one*@();
        @*advance-one*@();
      }
    }
    @*advance-one*@();
    return *this;
  }

  constexpr @*iterator*@& operator++() requires (K == to_utf_view_kind::replacement)
  {
    @*advance-one*@();
    return *this;
  }
```

This is because, in expected mode, we would needlessly store the code
units for U+FFFD in buf_ even though they were never read, and then we
would need special casing so that iterating a single ill-formed
input subsequence wouldn't deliver std::unexpected three times for
U+FFFD's three UTF-8 code units.

This change updates the type of buf_ to:

`expected<inplace_vector<charT, N>, utf_transcoding_error>`

This allows us to eliminate the success_ data member since its
information is now stored in buf_.

We can then inline `@*advance-one*@` into the body of `operator++`,
handling the error case without needing to hardcode a reliance on the
fact that U+FFFD is exactly three UTF-8 code units:

```
  constexpr @*iterator*@& operator++() {
    if (!@*buf_*@ || ++@*buf_index_*@ == @*buf_*@->size()) {
      if constexpr (forward_range<@*Base*@>) {
        @*buf_index_*@ = 0;
        ranges::advance(@*current_*@, @*to_increment_*@);
      }
      @*reseat*@();
    }
    return *this;
  }
```

This change has no negative performance consequences, since, for the
expected mode, it's equivalent to the status quo; and, for the
replacement mode, since buf_ is an exposition-only member,
implementers are free to elide the std::expected type away (which the
reference implementation does).

53 of 53 new or added lines in 1 file covered. (100.0%)

444 of 445 relevant lines covered (99.78%)

219.63 hits per line

Jobs
ID Job ID Ran Files Coverage
1 43945917042.1 16 Nov 2026 08:07PM UTC 5
99.78
GitHub Action Run
Source Files on build 43945917042
  • Tree
  • List 5
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #43945917042
  • 8133eeea on github
  • Prev Build on main (#43933169018)
  • Next Build on main (#43947353624)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc