From 973e39a25586af96c250df0d6f0d1f7d6782a42d Mon Sep 17 00:00:00 2001 From: apio Date: Fri, 30 Dec 2022 18:46:18 +0100 Subject: [PATCH] LinkedList: Move nonnull_or_empty_option to Option.h so everyone can use it --- luna/include/luna/LinkedList.h | 7 ------- luna/include/luna/Option.h | 9 ++++++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/luna/include/luna/LinkedList.h b/luna/include/luna/LinkedList.h index 6a899ea1..c390f986 100644 --- a/luna/include/luna/LinkedList.h +++ b/luna/include/luna/LinkedList.h @@ -2,13 +2,6 @@ #include #include -template inline Option nonnull_or_empty_option(T* ptr) -{ - if (ptr == nullptr) return {}; - else - return ptr; -} - template class LinkedList; template class LinkedListNode diff --git a/luna/include/luna/Option.h b/luna/include/luna/Option.h index 2173b704..8dcf4521 100644 --- a/luna/include/luna/Option.h +++ b/luna/include/luna/Option.h @@ -142,4 +142,11 @@ template class Option }; Storage m_storage; bool m_has_value { false }; -}; \ No newline at end of file +}; + +template inline Option nonnull_or_empty_option(T* ptr) +{ + if (ptr == nullptr) return {}; + else + return ptr; +} \ No newline at end of file