Skip to content

Commit

Permalink
Minor nit in ByteView.h
Browse files Browse the repository at this point in the history
Ensure t.data() and t.size() can be called for const T (slightly tighter
requirement).
  • Loading branch information
cculianu committed Jun 7, 2024
1 parent bb216fc commit 5994e28
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ByteView.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ class ByteView
/// and a .size() method -- such as QByteArray, std::vector, QString, std::array, etc.
template<typename T>
requires std::is_same_v<QString, T> /* special case for QString */ ||
requires(T t) { requires std::is_pointer_v<decltype(t.data())>;
{ t.size() } -> std::integral;
requires is_pod_v<std::remove_pointer_t<decltype(t.data())>>;
requires std::has_unique_object_representations_v<std::remove_pointer_t<decltype(t.data())>>;
requires !std::is_pointer_v<std::remove_pointer_t<decltype(t.data())>>; }
requires(const T t) { requires std::is_pointer_v<decltype(t.data())>;
{ t.size() } -> std::integral;
requires is_pod_v<std::remove_pointer_t<decltype(t.data())>>;
requires std::has_unique_object_representations_v<std::remove_pointer_t<decltype(t.data())>>;
requires !std::is_pointer_v<std::remove_pointer_t<decltype(t.data())>>; }
ByteView(const T &t) noexcept
: ByteView(ptr_cast<std::byte>(t.data()), t.size() * sizeof(*t.data())) {
static_assert (!std::is_same_v<T, QString>
Expand Down

0 comments on commit 5994e28

Please sign in to comment.