[cfe-dev] blocks with c++ lambas
    James Gregurich 
    bayoubengal at me.com
       
    Mon Sep 10 19:50:59 PDT 2012
    
    
  
thanks.
I had two problems. one was not using .mm and the other was I was attempting to use a lambda that took an argument. Since the argument was of the wrong type, the type didn't match for dispatch_async.
Question. does the lambda need to be defined in an objc++ file or can a .cpp translation unit pass the lambda to the objc++ translation unit which can then call dispatch_async()?
-James
> 
> Yes.  Short example:
> 
> #include <dispatch/dispatch.h>
> #include <cstdio>
> dispatch_once_t once;
> int main() {
>  dispatch_once(&once, []{printf("asdf\n");});
> }
> 
> -Eli
> 
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
    
    
More information about the cfe-dev
mailing list