mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
includes/std: Added std::IIndexed as a nicer wrapper around std::core::array_index()
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
import std.sys;
|
||||
import std.core;
|
||||
|
||||
/*!
|
||||
The array library contains a helper type to make it easier to create multi-dimensional arrays
|
||||
@@ -30,6 +31,16 @@ namespace auto std {
|
||||
std::assert($ - startAddress == NumBytes, "Not enough bytes available to fit a whole number of types");
|
||||
} [[format("std::impl::format_array")]];
|
||||
|
||||
|
||||
/**
|
||||
An interface type for getting the index of the currently processed element in an array. This is a nice wrapper around `std::core::array_index()`
|
||||
|
||||
To use it, inherit from it and use the `this.index` field to get the index of the current element
|
||||
*/
|
||||
struct IIndexed {
|
||||
const u64 index = std::core::array_index();
|
||||
};
|
||||
|
||||
namespace impl {
|
||||
|
||||
fn format_array(ref auto array) {
|
||||
|
||||
Reference in New Issue
Block a user