@@ -107,15 +107,30 @@ pointer's value in-place.
107107If the buffer holding the bencoded data is stable (i.e. won't change or be
108108destroyed until you're done working with the parsed representation), you can
109109decode the data as a *view* on the buffer to save memory. This results in all
110- parsed strings being nothing more than pointers pointing to slices of your
111- buffer. Simply add `_view` to the functions/types to take advantage of this:
110+ parsed strings being `std::string_view`s pointing to slices of your buffer.
111+ Simply add `_view` to the functions/types to take advantage of this:
112112
113113```c++
114114std::string buf = "3:foo";
115115bencode::data_view data = bencode::decode_view(buf); // or `decode_view_some`
116116auto value = std::get<bencode::string_view>(data);
117117```
118118
119+ #### Other Character Types
120+
121+ In addition to working with bencoded data as ` char ` s, you can use other
122+ underlying character types: ` char8_t ` or ` std::byte ` . For the former, the
123+ default bencoded string type is naturally ` std::u8string ` (or
124+ ` std::u8string_view ` for data views). For the latter, the string type is
125+ ` std::vector<std::byte> ` (or ` std::span<std::byte> ` ). The bencode data types for
126+ these are prefixed with ` u8 ` and ` b ` , respectively:
127+
128+ ``` c++
129+ std::vector<std::byte> buf = get_buffer();
130+ bencode::bdata = bencode::decode(buf);
131+ auto value = std::get<bencode::bstring>(data);
132+ ```
133+
119134#### Errors
120135
121136If there's an error trying to decode some bencode data, a ` decode_error ` will be
0 commit comments