From 7ea2e2733fa3ed40500185301d54e9ec708e9eb2 Mon Sep 17 00:00:00 2001 From: Victor Olin Date: Thu, 23 Mar 2023 13:09:50 +0100 Subject: [PATCH] Moved Heap::the for safe compilation --- src/GC/include/heap.hpp | 14 +------------- src/GC/lib/heap.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/GC/include/heap.hpp b/src/GC/include/heap.hpp index be1d199..a18f073 100644 --- a/src/GC/include/heap.hpp +++ b/src/GC/include/heap.hpp @@ -75,19 +75,7 @@ namespace GC * saved as the limit for scanning the stack in collect. */ - /** - * This implementation of the() guarantees laziness - * on the instance and a correct destruction with - * the destructor. - * - * @returns The singleton object. - */ - static Heap& the() - { - static Heap instance; - return instance; - } - + static Heap &the(); static void init(); static void dispose(); static void *alloc(size_t size); diff --git a/src/GC/lib/heap.cpp b/src/GC/lib/heap.cpp index f7aa92b..724d2d7 100644 --- a/src/GC/lib/heap.cpp +++ b/src/GC/lib/heap.cpp @@ -14,7 +14,18 @@ using std::cout, std::endl, std::vector, std::hex, std::dec; namespace GC { - + /** + * This implementation of the() guarantees laziness + * on the instance and a correct destruction with + * the destructor. + * + * @returns The singleton object. + */ + Heap& Heap::the() + { + static Heap instance; + return instance; + } /** * Initialises the heap singleton and saves the address