20#include "pw_span/span.h"
27using ByteSpan = span<std::byte>;
29using ConstByteSpan = span<const std::byte>;
46 static_assert(std::is_trivially_copyable_v<T>,
47 "cannot treat object as bytes: "
48 "copying bytes may result in an invalid object");
49 static_assert(std::has_unique_object_representations_v<T>,
50 "cannot treat object as bytes: "
51 "type includes indeterminate bytes which may leak information "
52 "or result in incorrect object hashing");
55 return pw::as_bytes(s);
72 static_assert(std::is_trivially_copyable_v<T>,
73 "cannot treat object as bytes: "
74 "copying bytes may result in an invalid object");
75 static_assert(std::has_unique_object_representations_v<T>,
76 "cannot treat object as bytes: "
77 "type includes indeterminate bytes which may leak information "
78 "or result in incorrect object hashing");
81 return pw::as_writable_bytes(s);
Definition: span_impl.h:235
span< const std::byte, sizeof(T)> ObjectAsBytes(const T &obj)
Definition: span.h:45
span< std::byte, sizeof(T)> ObjectAsWritableBytes(T &obj)
Definition: span.h:71
The Pigweed namespace.
Definition: alignment.h:27