libER 0.1.4.2
ELDEN RING API library
Loading...
Searching...
No Matches
singleton.hpp
Go to the documentation of this file.
1
9#pragma once
10
11#include <detail/optref.hpp>
12#include <detail/preprocessor.hpp>
13#include <detail/symbols.hpp>
14
15// LIBER_INTERFACE_CLASS specialization for ELDEN RING
16// singleton objects in static memory. Declares the instance()
17// method, which is defined separately as to not expose symbols
18// See detail/singleton.h
19#define FD4_SINGLETON_CLASS(CLASSNAME) \
20 [[nodiscard]] static liber::optref<CLASSNAME> instance() noexcept { \
21 return liber::symbol<"GLOBAL_" LIBER_STRINGIFY( \
22 CLASSNAME)>::as<CLASSNAME*>(); \
23 } \
24 LIBER_INTERFACE_CLASS(CLASSNAME)
Optional references based on std::optional.