LinkedList: Move nonnull_or_empty_option to Option.h so everyone can use it

This commit is contained in:
apio 2022-12-30 18:46:18 +01:00
parent 28f53f9ccf
commit 973e39a255
Signed by: apio
GPG Key ID: B8A7D06E42258954
2 changed files with 8 additions and 8 deletions

View File

@ -2,13 +2,6 @@
#include <luna/Option.h> #include <luna/Option.h>
#include <luna/TypeTraits.h> #include <luna/TypeTraits.h>
template <typename T> inline Option<T*> nonnull_or_empty_option(T* ptr)
{
if (ptr == nullptr) return {};
else
return ptr;
}
template <typename T> class LinkedList; template <typename T> class LinkedList;
template <typename T> class LinkedListNode template <typename T> class LinkedListNode

View File

@ -142,4 +142,11 @@ template <typename T> class Option
}; };
Storage m_storage; Storage m_storage;
bool m_has_value { false }; bool m_has_value { false };
}; };
template <typename T> inline Option<T*> nonnull_or_empty_option(T* ptr)
{
if (ptr == nullptr) return {};
else
return ptr;
}