Skip to content

Commit 28117d2

Browse files
committed
Expose emplace_back method of underlying std::vector in json_arrayt.
Using this method facilitates construction of the items in the json_array, using move rather than copy construction.
1 parent a589a56 commit 28117d2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/util/json.h

+6
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ class json_arrayt:public jsont
170170
return array.back();
171171
}
172172

173+
template <typename... argumentst>
174+
void emplace_back(argumentst &&... arguments)
175+
{
176+
array.emplace_back(std::forward<argumentst>(arguments)...);
177+
}
178+
173179
typedef jsont value_type; // NOLINT(readability/identifiers)
174180
};
175181

0 commit comments

Comments
 (0)