mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-25 12:45:32 +00:00
Avoid copying List
unnecessarily.
This commit is contained in:
parent
ba6e83191b
commit
efdf0e01a9
@ -41,7 +41,7 @@ struct ListClass : ClassDefinition<T, realm::List, CollectionClass<T>> {
|
|||||||
using Value = js::Value<T>;
|
using Value = js::Value<T>;
|
||||||
using ReturnValue = js::ReturnValue<T>;
|
using ReturnValue = js::ReturnValue<T>;
|
||||||
|
|
||||||
static ObjectType create_instance(ContextType, realm::List &);
|
static ObjectType create_instance(ContextType, realm::List);
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
static void get_length(ContextType, ObjectType, ReturnValue &);
|
static void get_length(ContextType, ObjectType, ReturnValue &);
|
||||||
@ -81,8 +81,8 @@ struct ListClass : ClassDefinition<T, realm::List, CollectionClass<T>> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
typename T::Object ListClass<T>::create_instance(ContextType ctx, realm::List &list) {
|
typename T::Object ListClass<T>::create_instance(ContextType ctx, realm::List list) {
|
||||||
return create_object<T, ListClass<T>>(ctx, new realm::List(list));
|
return create_object<T, ListClass<T>>(ctx, new realm::List(std::move(list)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
@ -135,7 +135,7 @@ struct NativeAccessor {
|
|||||||
return Object::validated_get_object(ctx, Value::validated_to_object(ctx, value), (uint32_t)index);
|
return Object::validated_get_object(ctx, Value::validated_to_object(ctx, value), (uint32_t)index);
|
||||||
}
|
}
|
||||||
static ValueType from_list(ContextType ctx, realm::List list) {
|
static ValueType from_list(ContextType ctx, realm::List list) {
|
||||||
return ListClass<T>::create_instance(ctx, list);
|
return ListClass<T>::create_instance(ctx, std::move(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Mixed to_mixed(ContextType ctx, ValueType &val) {
|
static Mixed to_mixed(ContextType ctx, ValueType &val) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user