1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Singleton: Add new macros to simplify singleton creation

The INLINE macros allow singletons to be declared and defined in one
line, without requiring a separate JUCE_IMPLEMENT_SINGLETON statement.
This commit is contained in:
reuk 2024-10-07 12:30:43 +01:00
parent 5179f4e720
commit 80ac9a78a0
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
44 changed files with 69 additions and 138 deletions

View file

@ -85,16 +85,13 @@ namespace
: configureArrangement (args);
}
JUCE_DECLARE_SINGLETON (GlyphArrangementCache<ArrangementArgs>, false)
JUCE_DECLARE_SINGLETON_INLINE (GlyphArrangementCache<ArrangementArgs>, false)
private:
LruCache<ArrangementArgs, ConfiguredArrangement> cache;
CriticalSection lock;
};
template <typename ArrangementArgs>
juce::SingletonHolder<GlyphArrangementCache<ArrangementArgs>, juce::CriticalSection, false> GlyphArrangementCache<ArrangementArgs>::singletonHolder;
//==============================================================================
template <typename Type>
Rectangle<Type> coordsToRectangle (Type x, Type y, Type w, Type h) noexcept