You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One thing we can do to make this easier for users is to accept C++20 ranges of std::byte where possible (probably have to be contiguous ranges). In places where we ultimately need to call out to a non-inline implementation, we can use std::span<std::byte> as the generic base implementation.
We can get the spans from std::as_bytes and std::as_writable_bytes. The concept for "a contiguous range of bytes" is encoded as the pqxx::binary concept.
The text was updated successfully, but these errors were encountered:
jtv
changed the title
Accept ranges where we currently use std::vector<std::byte> etc.
Accept ranges where we currently use pqxx::bytes and pqxx::bytes_viewJan 19, 2025
Fixes: #925
Extends a bunch more functions that accept `pqxx::bytes_view` with
variants which accept any type that satisfies the `pqxx::binary`
concept.
Also, change the `pqxx::bytes_view` type alies from being a
`std::basic_string_view<std::byte>` (which doesn't actually have to work
according to the standard!) to being a `std::span<std::byte>`. This
seems to be broadly compatible with existing code. For completeness I'm
adding a `pqxx::writable_bytes_view` as well.
Along the way I'm assuming support for C++17's `std::filesystem::path`,
and adding a conversion to `pqxx::zview`. With that, `pqxx::blob` no
longer needs explicit support for `std::filesystem::path` filenames; it
just accepts `pqxx::zview` and passing a `std::filesystem::path` will
just work. It avoids some ambiguities.
Fixes: #925
Extends a bunch more functions that accept `pqxx::bytes_view` with
variants which accept any type that satisfies the `pqxx::binary`
concept.
Also, change the `pqxx::bytes_view` type alias from being a
`std::basic_string_view<std::byte>` (which doesn't actually have to work
according to the standard!) to being a `std::span<std::byte>`. This
seems to be broadly compatible with existing code. For completeness I'm
adding a `pqxx::writable_bytes_view` as well.
We've got two C++ types to wrap binary data:
pqxx::bytes
pqxx::bytes_view
One thing we can do to make this easier for users is to accept C++20 ranges of
std::byte
where possible (probably have to be contiguous ranges). In places where we ultimately need to call out to a non-inline implementation, we can usestd::span<std::byte>
as the generic base implementation.We can get the spans from
std::as_bytes
andstd::as_writable_bytes
. The concept for "a contiguous range of bytes" is encoded as thepqxx::binary
concept.The text was updated successfully, but these errors were encountered: