Skip to content

Commit f0a82f1

Browse files
committed
reconstruct_vec: Allocate size when creating the vector
gcc/rust/ChangeLog: * ast/rust-ast.h (reconstruct_vec): Pre-allocate size of vector.
1 parent 27ef26e commit f0a82f1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

gcc/rust/ast/rust-ast.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ template <typename T>
106106
std::vector<std::unique_ptr<T>>
107107
reconstruct_vec (const std::vector<std::unique_ptr<T>> &to_reconstruct)
108108
{
109-
std::vector<std::unique_ptr<T>> reconstructed;
109+
std::vector<std::unique_ptr<T>> reconstructed (to_reconstruct.size ());
110110

111111
for (const auto &elt : to_reconstruct)
112112
reconstructed.emplace_back (std::unique_ptr<T> (elt->reconstruct_impl ()));

0 commit comments

Comments
 (0)