arm: async echo app

This commit is contained in:
2022-05-16 20:56:25 -07:00
parent 30d9a2d7c8
commit 932b8d4582
25 changed files with 3043 additions and 29 deletions

23
arm/buffer.h Normal file
View File

@@ -0,0 +1,23 @@
#pragma once
#include <span>
#include <utility>
struct buffer {
std::span<std::byte> data;
buffer() = default;
buffer(std::span<std::byte> d) : data(d) {}
static buffer make(size_t size) {
return buffer({new std::byte[size], size});
}
buffer(buffer& other) = delete;
buffer& operator=(buffer& other) = delete;
buffer(buffer&& other) : data(std::exchange(other.data, {})) {}
buffer& operator=(buffer&& other) { data = std::exchange(other.data, {}); return *this; }
~buffer() { if (data.data()) { delete[] data.data(); }; }
};