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

Added flag JUCE_COMPILER_SUPPORTS_LAMBDAS

This commit is contained in:
jules 2014-10-08 11:26:55 +01:00
parent fc6d485b29
commit 89854c55b9
3 changed files with 14 additions and 0 deletions

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

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:

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.