Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions paper/P2728.md
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ You can also substitute a different replacement character by changing the
result of the `else` clause, or add exception-based error handling by throwing
at that point.

### Why there are three `to_utfN_view`s and no `to_utf_view`
### Why There Are Three `to_utfN_view`s and No `to_utf_view`

The views in `std::ranges` are constrained to accept only `std::ranges::view`
template parameters. However, they accept `std::ranges::viewable_range`s in
Expand Down Expand Up @@ -367,14 +367,14 @@ an exposition-only transformation functor that performs the needed cast.

# Additional Examples

## Transcoding a UTF-8 string literal to a `std::u32string`
## Transcoding a UTF-8 String Literal to a `std::u32string`

```cpp
std::u32string hello_world =
u8"こんにちは世界" | std::views::to_utf32 | std::ranges::to<std::u32string>();
```

## Sanitizing potentially invalid Unicode
## Sanitizing Potentially Invalid Unicode

Note that transcoding to and from the same encoding is not a no-op; it must
maintain the invariant that the output of a transcoding view is always valid
Expand All @@ -387,7 +387,7 @@ std::basic_string<CharT> sanitize(CharT const* str) {
}
```

## Returning the final non-ASCII code point in a string, transcoding backwards lazily:
## Returning the Final Non-ASCII Code Point in a String, Transcoding Backwards Lazily:

```cpp
std::optional<char32_t> last_nonascii(std::ranges::view auto str) {
Expand All @@ -399,7 +399,7 @@ std::optional<char32_t> last_nonascii(std::ranges::view auto str) {
}
```

## Transcoding strings and throwing a descriptive exception on invalid UTF
## Transcoding Strings and Throwing a Descriptive Exception on Invalid UTF

(This assumes a reflection-based `enum_to_string` function.)

Expand Down Expand Up @@ -427,7 +427,7 @@ std::basic_string<ToChar> transcode_or_throw(std::basic_string_view<FromChar> in
u8"hi🙂" | std::views::take(5) | std::ranges::to<std::u8string>());
```

## Changing the suits of Unicode playing card characters:
## Changing the Suits of Unicode Playing Card Characters:

```cpp
enum class suit : std::uint8_t {
Expand Down Expand Up @@ -481,7 +481,7 @@ Both libraries have comprehensive tests.

# Wording

## Additional helper concepts
## Additional Helper Concepts

Add the following to [range.utility.helpers]{.sref}:

Expand Down
Loading