...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Push an array formed by popping n
values from the stack.
void
push_array(
std::size_t
n);
This function pushes an array
value onto the stack. The
array is formed by first popping the top n
values from the stack. If the stack contains fewer than n
values, or if any of the top n
values on the stack is a key, the behavior is undefined.
The following statements produce an array with the contents 1, 2, 3:
value_stack st; // reset must be called first or else the behavior is undefined st.reset(); // Place three values on the stack st.push_int64( 1 ); st.push_int64( 2 ); st.push_int64( 3 ); // Remove the 3 values, and push an array with those 3 elements on the stack st.push_array( 3 ); // Pop the object from the stack and take ownership. value jv = st.release(); assert( serialize(jv) == "[1,2,3]" ); // At this point, reset must be called again to use the stack
Name |
Description |
---|---|
|
The number of values to pop from the top of the stack to form the array. |