mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
optimize move constructor
This commit is contained in:
parent
27c8307562
commit
a886404940
2 changed files with 44 additions and 34 deletions
|
|
@ -52,9 +52,9 @@ namespace dv {
|
|||
throw std::runtime_error("value is not a list");
|
||||
}
|
||||
|
||||
value& value::add(value v) {
|
||||
void value::add(value v) {
|
||||
if (type == value_type::list) {
|
||||
return val.list->add(std::move(v));
|
||||
return val.list->push(std::move(v));
|
||||
}
|
||||
throw std::runtime_error("value is not a list");
|
||||
}
|
||||
|
|
@ -72,11 +72,17 @@ namespace dv {
|
|||
}
|
||||
|
||||
value& value::object() {
|
||||
return add(dv::object());
|
||||
if (type == value_type::list) {
|
||||
return val.list->add(std::make_shared<objects::Object>());
|
||||
}
|
||||
throw std::runtime_error("value is not a list");
|
||||
}
|
||||
|
||||
value& value::list() {
|
||||
return add(dv::list());
|
||||
if (type == value_type::list) {
|
||||
return val.list->add(std::make_shared<objects::List>());
|
||||
}
|
||||
throw std::runtime_error("value is not a list");
|
||||
}
|
||||
|
||||
list_t::iterator value::begin() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue