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 ReturnValue = js::ReturnValue<T>;
|
||||
|
||||
static ObjectType create_instance(ContextType, realm::List &);
|
||||
static ObjectType create_instance(ContextType, realm::List);
|
||||
|
||||
// properties
|
||||
static void get_length(ContextType, ObjectType, ReturnValue &);
|
||||
|
@ -81,8 +81,8 @@ struct ListClass : ClassDefinition<T, realm::List, CollectionClass<T>> {
|
|||
};
|
||||
|
||||
template<typename T>
|
||||
typename T::Object ListClass<T>::create_instance(ContextType ctx, realm::List &list) {
|
||||
return create_object<T, ListClass<T>>(ctx, new 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(std::move(list)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
|
@ -135,7 +135,7 @@ struct NativeAccessor {
|
|||
return Object::validated_get_object(ctx, Value::validated_to_object(ctx, value), (uint32_t)index);
|
||||
}
|
||||
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) {
|
||||
|
|
Loading…
Reference in New Issue