Files
1brc/source/io.ixx
T
2026-09-09 00:52:00 -03:00

32 lines
622 B
C++

export module io;
import std;
namespace brc {
export [[nodiscard]] std::string read_file(const std::filesystem::path& path);
export class mapped_file {
private:
int fd;
void* data = nullptr;
std::size_t length = 0;
public:
explicit mapped_file(const std::filesystem::path& path);
mapped_file(const mapped_file&) = delete;
mapped_file& operator=(const mapped_file&) = delete;
mapped_file(mapped_file&& rhs) noexcept;
mapped_file& operator=(mapped_file&& rhs) noexcept;
~mapped_file();
operator std::string_view() const noexcept;
[[nodiscard]] std::size_t size() const noexcept;
};
} // namespace brc