summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/value.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/include/value.h b/include/value.h
index 2fe940a..77bc0e2 100644
--- a/include/value.h
+++ b/include/value.h
@@ -457,28 +457,25 @@ public:
// allocate a result
std::vector<T> result;
-
+
// reserve enough space
size_t count = size();
result.reserve(count);
-
+
// and fill the result vector
- for (size_t i = 0; i<count; i++)
+ for (size_t i = 0; i<count; i++)
{
// check if the index exists
if (!contains(i)) continue;
-
- // get the value object
- Value value(get(i));
-
- // add it to the vector
- result.push_back(value);
+
+ // get the value and add it to the vector
+ result.emplace_back(get(i));
}
-
+
// done
return result;
}
-
+
/**
* Convert the object to a map with string index and Php::Value value
* @return std::map