cereal
A C++11 library for serialization
|
Go to the documentation of this file.
28 #ifndef CEREAL_DETAILS_STATIC_OBJECT_HPP_
29 #define CEREAL_DETAILS_STATIC_OBJECT_HPP_
33 #if CEREAL_THREAD_SAFE
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();
128 #endif // CEREAL_DETAILS_STATIC_OBJECT_HPP_
A class that acts like std::lock_guard.
Definition: static_object.hpp:88
Preprocessor macros that can customise the cereal library.
#define CEREAL_DLL_EXPORT
Prevent link optimization from removing non-referenced static objects.
Definition: static_object.hpp:51
A static, pre-execution object.
Definition: static_object.hpp:67
static LockGuard lock()
Attempts to lock this static object for the current scope.
Definition: static_object.hpp:110
#define CEREAL_NOEXCEPT
Defines the CEREAL_NOEXCEPT macro to use instead of noexcept.
Definition: macros.hpp:130