-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
Are you planning to add linq_aggregate API for primitive types?
NSNumber* totalCount = [shoppingCart linq_aggregate: ^NSNumber*(id<MyCommodity> item, NSNumber* aggregate)
{
NSNumber* orderedItemsCount = [item numberOfOrders];
NSUInteger newResult = [orderedItemsCount unsignedIntegerValue] + [aggregate unsignedIntegerValue];
return @(newResult);
}];In this example there is a lot of boxing/unboxing (NSNumber ==> NSUInteger ==> NSNumber) which is a good thing to avoid.
P.S. I know that integers can be "safely" casted to id. But I strongly dislike this approach. Moreover, it does not work for [NSNumber floatValue].
Metadata
Metadata
Assignees
Labels
No labels