[cfe-dev] objc++ enhancements for new c++ features

James Gregurich via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 28 13:57:05 PDT 2018



> On Mar 28, 2018, at 3:07 PM, John McCall <rjmccall at apple.com> wrote:
> 
> Now, there's an idea we've been kicking around for a long time to support typed selectors; I guess they would look something like
>   SEL<NSString*()>
> for the type of
>   - (NSString*) foo;


I'm not a stickler for exactly what gets done. My goal is to be able to write code like that below. I'm open to any idea that allows templating to utilize objc method declarations as easily as can utilize c++ class member function declarations. My end goal in posting to the list is to make the cocoa programming experience from c++ be as convenient and complete as possible. the objc++ compiler is one of the best pieces of software that Apple has engineered. The experience can be improved significantly by filling in a few gaps.




std::packaged_task< int (cTest*, NSString*)  >  tmpTask(   @lambda( -[cMyClass methodUsingString:] )   );
auto tmpCFuture = tmpTask.get_future();

auto tmpCPtr = [[[cTest alloc] init] autorelease];

tmpTask( tmpCPtr, @"hello world"  );

auto tmpResult = tmpCFuture.get();



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180328/1b77ec1d/attachment.html>


More information about the cfe-dev mailing list