Commit b9836f4a authored by John Fremlin VII's avatar John Fremlin VII Committed by Jordan DeLong

add pop_back to arrays

Summary: Add a pop_back() function to dynamic arrays.

Test Plan: - used it

Reviewed By: delong.j@fb.com

FB internal diff: D569440
parent d0dd99c7
......@@ -646,6 +646,11 @@ inline void dynamic::push_back(dynamic&& v) {
array.push_back(std::move(v));
}
inline void dynamic::pop_back() {
auto& array = get<Array>();
array.pop_back();
}
inline std::size_t dynamic::hash() const {
switch (type()) {
case OBJECT:
......
......@@ -415,6 +415,14 @@ public:
void push_back(dynamic const&);
void push_back(dynamic&&);
/*
* Remove an element from the back of an array. If this is not an array,
* throws TypeError.
*
* Does not invalidate iterators.
*/
void pop_back();
/*
* Get a hash code. This function is called by a std::hash<>
* specialization, also.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment