categories = @[@"Cafe", @"Shop", @"Mall"]; // now compiles But we can do it better! #include <array> static std::array<NSString *, 3> categories{@"Cafe", @"Shop", @"Mall"};
NSMutableSet) C.std::list (doubled linked list) D.std::deque (similar to std::vector but you can also do emplace_front()) E. std::pair F. std::tuple 52
NSMutableSet) C.std::list (doubled linked list) D.std::deque (similar to std::vector but you can also do emplace_front()) E. std::pair F. std::tuple G.std::any 53
NSMutableSet) C.std::list (doubled linked list) D.std::deque (similar to std::vector but you can also do emplace_front()) E. std::pair F. std::tuple G.std::any and so on… 54
string = @"str"; NSArray * array = @[]; NSDictionary * dictionary = @{}; 65 Do u see redundancy? How about this, Elon Musk? auto data = [[NSData alloc] init]; auto string = @"str"; auto array = @[]; auto dictionary = @{};
ret { body } [] - capture nothing [&] - capture all by reference [=] - capture all by making copy [&a] - capture a by reference [a] - capture a by copy *for additional info read about std::function auto l = [](NSData * result, NSUInteger resultCode, NSDictionary * info) -> NSString * { // … };
} return std::nullopt; // or just {} } if (auto const point = self.point) { // do something with point } else { // handle invalid point } CGPoint point = *self.point; // which is equal to point! 74