core/irrt: add List

Needed for implementing np_array()
This commit is contained in:
lyken 2024-08-20 14:51:40 +08:00
parent 7910de10a1
commit 13715dbda9
No known key found for this signature in database
GPG Key ID: 3BD5FC6AC8325DD8
2 changed files with 16 additions and 1 deletions

View File

@ -8,4 +8,4 @@
#include "irrt/ndarray/basic.hpp"
#include "irrt/ndarray/def.hpp"
#include "irrt/ndarray/iter.hpp"
#include "irrt/ndarray/indexing.hpp"
#include "irrt/ndarray/indexing.hpp"

View File

@ -2,6 +2,21 @@
#include "irrt/int_types.hpp"
#include "irrt/math_util.hpp"
#include "irrt/slice.hpp"
namespace {
/**
* @brief A list in NAC3.
*
* The `items` field is opaque. You must rely on external contexts to
* know how to interpret it.
*/
template<typename SizeT>
struct List {
uint8_t* items;
SizeT len;
};
} // namespace
extern "C" {
// Handle list assignment and dropping part of the list when