Files
json/docs/mkdocs/docs/api/basic_json/cend.md
T
Niels Lohmann 172eba6e46 docs: cross-link concept pages and API pages in See also sections
Add See also links in both directions between the concept pages (features,
home, integration) and the API pages, write API links in code font, give every
entry a comment after a dash, and show the callback event figure on the parser
callbacks page.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
2026-10-26 16:17:03 +01:00

1.3 KiB

nlohmann::basic_json::cend

const_iterator cend() const noexcept;

Returns an iterator to one past the last element.

--8<-- "images/range-begin-end.svg"

`cend()` points to the position after the last element, like `end()`, and `begin()` to the first element; the dashed cell is the past-the-last position, which must not be dereferenced.

Return value

iterator one past the last element

Exception safety

No-throw guarantee: this member function never throws exceptions.

Complexity

Constant.

Examples

??? example

The following code shows an example for `cend()`.

```cpp
--8<-- "examples/cend.cpp"
```

Output:

```json
--8<-- "examples/cend.output"
```

See also

  • end - returns an iterator to one past the last element
  • cbegin - returns a const iterator to the first element
  • crend - returns a const reverse iterator to one before the first element
  • Iterators - the article on iterators
  • basic_json_view::cend - the same iteration on a zero-copy view

Version history

  • Added in version 1.0.0.