Browse Source

Added flag JUCE_COMPILER_SUPPORTS_LAMBDAS

tags/2021-05-28
jules 11 years ago
parent
commit
89854c55b9
3 changed files with 14 additions and 0 deletions
  1. +9
    -0
      modules/juce_core/system/juce_PlatformDefs.h
  2. +3
    -0
      modules/juce_events/messages/juce_MessageManager.cpp
  3. +2
    -0
      modules/juce_events/messages/juce_MessageManager.h

+ 9
- 0
modules/juce_core/system/juce_PlatformDefs.h View File

@@ -337,6 +337,10 @@ namespace juce
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 407 && ! defined (JUCE_DELETED_FUNCTION)
#define JUCE_DELETED_FUNCTION = delete
#endif
#if (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 && ! defined (JUCE_COMPILER_SUPPORTS_LAMBDAS)
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#endif
#if JUCE_CLANG && defined (__has_feature)
@@ -356,6 +360,10 @@ namespace juce
#define JUCE_DELETED_FUNCTION = delete
#endif
#if __has_feature (cxx_lambdas)
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#ifndef JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#endif
@@ -372,6 +380,7 @@ namespace juce
#if defined (_MSC_VER) && _MSC_VER >= 1700
#define JUCE_COMPILER_SUPPORTS_OVERRIDE_AND_FINAL 1
#define JUCE_COMPILER_SUPPORTS_LAMBDAS 1
#endif
#ifndef JUCE_DELETED_FUNCTION


+ 3
- 0
modules/juce_events/messages/juce_MessageManager.cpp View File

@@ -131,6 +131,7 @@ void MessageManager::stopDispatchLoop()
#endif
//==============================================================================
#if JUCE_COMPILER_SUPPORTS_LAMBDAS
struct AsyncFunction : private MessageManager::MessageBase
{
AsyncFunction (std::function<void(void)> f) : fn (f) { post(); }
@@ -146,7 +147,9 @@ void MessageManager::callAsync (std::function<void(void)> f)
{
new AsyncFunction (f);
}
#endif
//==============================================================================
class AsyncFunctionCallback : public MessageManager::MessageBase
{
public:


+ 2
- 0
modules/juce_events/messages/juce_MessageManager.h View File

@@ -91,10 +91,12 @@ public:
#endif
//==============================================================================
#if JUCE_COMPILER_SUPPORTS_LAMBDAS
/** Asynchronously invokes a function or C++11 lambda on the message thread.
Internally this uses the CallbackMessage class to invoke the callback.
*/
static void callAsync (std::function<void(void)>);
#endif
/** Calls a function using the message-thread.


Loading…
Cancel
Save