From b21a355e86828629511e3769209291fd6c780692 Mon Sep 17 00:00:00 2001 From: RiscadoA Date: Fri, 22 Sep 2023 16:24:15 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20preview=20for=20PR=20546=20?= =?UTF-8?q?=F0=9F=9B=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pr-preview/pr-546/examples-core-reflection-traits-array.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pr-preview/pr-546/examples-core-reflection-traits-array.html b/pr-preview/pr-546/examples-core-reflection-traits-array.html index ec1ac4f41..38aaf04d4 100644 --- a/pr-preview/pr-546/examples-core-reflection-traits-array.html +++ b/pr-preview/pr-546/examples-core-reflection-traits-array.html @@ -68,7 +68,7 @@

{ CUBOS_INFO("Element {}: {}", i, *static_cast<const int32_t*>(arrayTrait.get(instance, i))); } -}

In this example, we're only supporting arrays of ints, but we could for example implement a printing function which supports all primitive types.

To make calling our function easier, we can add a convenience typed wrapper:

template <typename T>
+}

In this example, we're only supporting arrays of int32_ts, but we could for example implement a printing function which supports all primitive types.

To make calling our function easier, we can add a convenience typed wrapper:

template <typename T>
 void printArray(const T& array)
 {
     using cubos::core::reflection::reflect;
@@ -90,7 +90,7 @@ 

// Element 4: 5 // Element 5: 8 // Element 6: 13 -}

Its important to note that both the includes above are necessary, as we're reflecting the type std::vector<int>, which also means reflecting int.

Executing the sample should output:

    // Array with 7 elements of type int32_t
+}

Its important to note that both the includes above are necessary, as we're reflecting the type std::vector<int32_t>, which also means reflecting int32_t.

Executing the sample should output:

    // Array with 7 elements of type int32_t
     // Element 0: 1
     // Element 1: 1
     // Element 2: 2