@@ -33,7 +33,7 @@ ScalarType deduceType(NSNumber *number);
3333 * @return The value converted to type T.
3434 */
3535template <typename T>
36- T extractValue (NSNumber *number) {
36+ T toType (NSNumber *number) {
3737 ET_CHECK_MSG (!(isFloatingType (deduceType (number)) &&
3838 isIntegralType (CppTypeToScalarType<T>::value, true )),
3939 " Cannot convert floating point to integral type" );
@@ -87,7 +87,7 @@ std::vector<T> toVector(NSArray<NSNumber *> *array) {
8787 std::vector<T> vector;
8888 vector.reserve (array.count );
8989 for (NSNumber *number in array) {
90- vector.push_back (extractValue <T>(number));
90+ vector.push_back (toType <T>(number));
9191 }
9292 return vector;
9393}
@@ -108,10 +108,11 @@ constexpr bool isNSNumberWrapable =
108108 * @return An NSArray populated with NSNumber objects representing the container's items.
109109 */
110110template <typename Container>
111+ NS_RETURNS_RETAINED
111112NSArray <NSNumber *> *toNSArray (const Container &container) {
112113 static_assert (isNSNumberWrapable<typename Container::value_type>, " Invalid container value type" );
113114 const NSUInteger count = std::distance (std::begin (container), std::end (container));
114- NSMutableArray <NSNumber *> *array = [NSMutableArray arrayWithCapacity : count];
115+ NSMutableArray <NSNumber *> *array = [[ NSMutableArray alloc ] initWithCapacity : count];
115116 for (const auto &item : container) {
116117 [array addObject: @(item)];
117118 }
0 commit comments