Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef XDISPATCH_LAMBDA_BLOCKS_H_
00029 #define XDISPATCH_LAMBDA_BLOCKS_H_
00030
00036 #ifndef __XDISPATCH_INDIRECT__
00037 #error "Please #include <xdispatch/dispatch.h> instead of this file directly."
00038 #endif
00039
00096 #ifndef XDISPATCH_DOXYGEN_RUN
00097
00098
00099 #ifdef __BLOCKS__
00100 # include <Block.h>
00101 # include <stddef.h>
00102 # define XDISPATCH_BLOCK ^
00103 # ifndef XDISPATCH_NO_KEYWORDS
00104 # define $ ^
00105 # endif
00106 # define XDISPATCH_BLOCK_PERSIST(A) Block_copy(A)
00107 # define XDISPATCH_BLOCK_COPY(A) Block_copy(A)
00108 # define XDISPATCH_BLOCK_DELETE(A) Block_release(A)
00109 # define XDISPATCH_BLOCK_EXEC(A) (A)
00110
00111 typedef void (^dispatch_iteration_block_t)(size_t);
00112 typedef dispatch_block_t dispatch_block_store;
00113 typedef dispatch_iteration_block_t dispatch_iteration_block_store;
00114 # define XDISPATCH_HAS_BLOCKS
00115 # if defined(__cplusplus) && !defined(__clang__)
00116 # warning "Sadly blocks are currently broken in C++ on this platform, we recommend using gcc 4.5.1 or clang 2.0 instead"
00117 # endif
00118
00119
00120 #elif _MSC_VER >= 1600
00121
00122 # include <functional>
00123 # define XDISPATCH_BLOCK [=]
00124 # ifndef XDISPATCH_NO_KEYWORDS
00125 # define $ [=]
00126 # endif
00127 # define XDISPATCH_BLOCK_PERSIST(A) (A)
00128 # define XDISPATCH_BLOCK_COPY(A) (A)
00129 # define XDISPATCH_BLOCK_DELETE(A) {}
00130 # define XDISPATCH_BLOCK_EXEC(A) (A)
00131 typedef const std::tr1::function< void (void) >& dispatch_block_t;
00132 typedef const std::tr1::function< void (size_t) >& dispatch_iteration_block_t;
00133 typedef std::tr1::function< void (void) > dispatch_block_store;
00134 typedef std::tr1::function< void (size_t) > dispatch_iteration_block_store;
00135 # define XDISPATCH_HAS_BLOCKS
00136
00137
00138 #elif defined __GXX_EXPERIMENTAL_CXX0X__
00139
00140 # include <tr1/functional>
00141 # define XDISPATCH_BLOCK [=]
00142 # ifndef XDISPATCH_NO_KEYWORDS
00143 # define $ [=]
00144 # endif
00145 # define XDISPATCH_BLOCK_PERSIST(A) (A)
00146 # define XDISPATCH_BLOCK_COPY(A) (A)
00147 # define XDISPATCH_BLOCK_DELETE(A) {}
00148 # define XDISPATCH_BLOCK_EXEC(A) (A)
00149 typedef const std::tr1::function< void (void) >& dispatch_block_t;
00150 typedef const std::tr1::function< void (size_t) >& dispatch_iteration_block_t;
00151 typedef std::tr1::function< void (void) > dispatch_block_store;
00152 typedef std::tr1::function< void (size_t) > dispatch_iteration_block_store;
00153 # define XDISPATCH_HAS_BLOCKS
00154
00155 #else
00156
00157 # define XDISPATCH_BLOCK "No Block support!"
00158
00159 #endif
00160
00161 #endif
00162
00163 #ifdef XDISPATCH_DOXYGEN_RUN
00164 # define $ [=]
00165 #endif
00166
00169 #endif