28#ifndef CEREAL_DETAILS_STATIC_OBJECT_HPP_
29#define CEREAL_DETAILS_STATIC_OBJECT_HPP_
47#if defined(_MSC_VER) && !defined(__clang__)
48# define CEREAL_DLL_EXPORT __declspec(dllexport)
51# define CEREAL_DLL_EXPORT __attribute__ ((visibility("default")))
52# define CEREAL_USED __attribute__ ((__used__))
82 static T & getInstance()
90 #if CEREAL_THREAD_SAFE
94 std::unique_lock<std::mutex> lock;
112 #if CEREAL_THREAD_SAFE
113 static std::mutex instanceMutex;
124 template <
class T> T & StaticObject<T>::instance = StaticObject<T>::create();
A class that acts like std::lock_guard.
Definition: static_object.hpp:89
A static, pre-execution object.
Definition: static_object.hpp:68
static LockGuard lock()
Attempts to lock this static object for the current scope.
Definition: static_object.hpp:110
Preprocessor macros that can customise the cereal library.
#define CEREAL_NOEXCEPT
Defines the CEREAL_NOEXCEPT macro to use instead of noexcept.
Definition: macros.hpp:130
#define CEREAL_DLL_EXPORT
Prevent link optimization from removing non-referenced static objects.
Definition: static_object.hpp:51