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

reference front();
const_reference front() const;

Description

Returns a reference to the first element in the container. Calling front on an empty container is undefined.

For a JSON container c, the expression c.front() is equivalent to *c.begin().

Parameters

None.

Return value

Reference to the first 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

  • back access the last element