From 701749b2e56882779abfbc18774be311678a6778 Mon Sep 17 00:00:00 2001 From: Relintai Date: Fri, 29 Dec 2023 13:31:27 +0100 Subject: [PATCH] Added a new helper method to MLPPVector. --- mlpp/lin_alg/mlpp_vector.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mlpp/lin_alg/mlpp_vector.h b/mlpp/lin_alg/mlpp_vector.h index 15086b4..9bf1be2 100644 --- a/mlpp/lin_alg/mlpp_vector.h +++ b/mlpp/lin_alg/mlpp_vector.h @@ -14,13 +14,13 @@ #include "core/object/resource.h" -#else +#else +#include "core/containers/vector.h" #include "core/defs.h" #include "core/math_funcs.h" -#include "core/pool_arrays.h" -#include "core/containers/vector.h" #include "core/os/memory.h" +#include "core/pool_arrays.h" #include "gen/resource.h" @@ -93,6 +93,16 @@ public: _data[p_index] = p_val; } + _FORCE_INLINE_ const real_t &element_get_ref(int p_index) const { + CRASH_BAD_INDEX(p_index, _size); + return _data[p_index]; + } + + _FORCE_INLINE_ real_t &element_get_ref(int p_index) { + CRASH_BAD_INDEX(p_index, _size); + return _data[p_index]; + } + void fill(real_t p_val); void insert(int p_pos, real_t p_val);