Reduce cpp freatures usage of Array container.

Almost ready to be inter-operable with C
This commit is contained in:
2024-11-30 18:54:19 -05:00
parent cc245cc263
commit 6d04165b96
11 changed files with 235 additions and 133 deletions

View File

@ -187,7 +187,7 @@
#if !defined(typeof) && (!GEN_COMPILER_C || __STDC_VERSION__ < 202311L)
# if ! GEN_COMPILER_C
# define typeof
# define typeof decltype
# elif defined(_MSC_VER)
# define typeof(x) __typeof(x)
# elif defined(__GNUC__) || defined(__clang__)
@ -197,4 +197,12 @@
# endif
#endif
// This is intended to only really be used internally or with the C-library variant
// C++ users can just use the for-range directly.
#if GEN_COMPILER_C
# define foreach(Type, entry_id, iterable) for ( Type entry_id = begin(iterable); entry_id != end(iterable); entry_id = next(entry_id) )
#else
# define foreach(Type, entry_id, iterable) for ( Type entry_id : iterable )
#endif
#pragma endregion Macros