On Mon, 22 Jun 2026 at 13:00, Robert A.H. Leahy <rleahy@rleahy.ca> wrote:
You're ignoring the fact that views::from_big_endian_bytes is less generally applicable than views::from_big_endian.

If I have some structure:

struct message {
  std::uint16_t message_type;
  std::array<uint16_t, 5> data;
};

Then views::from_big_endian is a good fit for consuming the wire-endian data array, whereas views::from_big_endian_bytes is not.

I would not use a view in this situation at all, but make a function that takes an array and returns an array with each element byte-swapped.

But I guess that's a bit beside the point; if there was a really large amount of data, you may approach this differently, but if there was a large amount of data, maybe you wouldn't eagerly load it all into memory either, or keep it memory-mapped, or something. This is all a bit academic.