diff --git a/source/coral.cpp b/source/coral.cpp index 7dcaf2a..bcf7085 100644 --- a/source/coral.cpp +++ b/source/coral.cpp @@ -461,6 +461,13 @@ export namespace coral { // Input/output operations. export namespace coral { + /** + * Returns `value` reinterpreted as a sequence of bytes. + */ + slice as_bytes(auto & value) { + return {reinterpret_cast(&value), sizeof(value)}; + } + /** * Compares `a` and `b`, returning the difference between them or `0` if they are identical. */