nlohmann::basic_json::back - renxiaobo27/json GitHub Wiki

reference back();
const_reference back() const;

Description

Returns a reference to the last element in the container. Calling back on an empty container is undefined.

For a JSON container c, the expression return c.back(); is equivalent to { auto tmp = c.end(); --tmp; return *tmp; }.

Parameters

None.

Return value

Reference to the last element. In cast of number, string, or boolean values, a reference to the value is returned.

Complexity

Constant.

Exceptions

std::out_of_range when called on null value.

See also

  • front access the first element