/** * Downloaded from https://github.com/bytecodealliance/wasmtime-cpp/blob/main/include/wasmtime.hh * License: Apache License 2.0 */ /** * \mainpage * * This project is a C++ API for * [Wasmtime](https://github.com/bytecodealliance/wasmtime). Support for the * C++ API is exclusively built on the [C API of * Wasmtime](https://docs.wasmtime.dev/c-api/), so the C++ support for this is * simply a single header file. To use this header file, though, it must be * combined with the header and binary of Wasmtime's C API. Note, though, that * while this header is built on top of the `wasmtime.h` header file you should * only need to use the contents of this header file to interact with Wasmtime. * * Examples can be [found * online](https://github.com/bytecodealliance/wasmtime-cpp/tree/main/examples) * and otherwise be sure to check out the * [README](https://github.com/bytecodealliance/wasmtime-cpp/blob/main/README.md) * for simple usage instructions. Otherwise you can dive right in to the * reference documentation of \ref wasmtime.hh * * \example hello.cc * \example gcd.cc * \example linking.cc * \example memory.cc * \example interrupt.cc * \example externref.cc */ /** * \file wasmtime.hh */ #ifndef WASMTIME_HH #define WASMTIME_HH #include #include #include #include #include #include #include #include #ifdef __cpp_lib_span #include #endif #include "wasmtime.h" namespace wasmtime { #ifdef __cpp_lib_span /// \brief Alias to C++20 std::span when it is available template using Span = std::span; #else /// \brief Means number of elements determined at runtime inline constexpr size_t dynamic_extent = std::numeric_limits::max(); /** * \brief Span class used when c++20 is not available * @tparam T Type of data * @tparam Extent Static size of data refered by Span class */ template class Span { public: /// \brief Type used to iterate over this span (a raw pointer) using iterator = T *; /// \brief Constructor of Span class Span(T *t, std::size_t n) : ptr_{t}, size_{n} {} /// \brief Constructor of Span class for containers template