Created nlohmann::basicjson::back (markdown)

Niels committed 2015-04-12 15:27:18 +02:00
1 parent 291cd250cd
commit da258f0ca2
1 file changed
+31
+31
@@ -0,0 +1,31 @@
```cpp
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**](https://github.com/nlohmann/json/wiki/nlohmann::basicjson::front)<br>
access the first element