nlohmann / json

JSON for Modern C++
https://json.nlohmann.me
MIT License
41.3k stars 6.58k forks source link

Docs have incorrect info for `update()` #4307

Closed whompyjaw closed 3 months ago

whompyjaw commented 3 months ago

Description

Docs say that v3.10.4 has merge_update as a parameter, but it actually does not. v3.10.5 does. https://github.com/nlohmann/json/blob/4f8fba14066156b73f1189a2b8bd568bde5284c5/include/nlohmann/json.hpp#L3144

My team uses 3.10.4 and ran into this.

Reproduction steps

No production needed. Comparing the code is sufficient.

Expected vs. actual results

I expected merge_objects to be in 3.10.4 per the docs stating that.

Minimal code example

No response

Error messages

eanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::update(const_reference) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; const_reference = const nlohmann::basic_json<>&]’
23501 |     void update(const_reference j)
      |          ^~~~~~
json_nlohmann-3.10.4/single_include/nlohmann/json.hpp:23501:10: note:   candidate expects 1 argument, 2 provided
json_nlohmann-3.10.4/single_include/nlohmann/json.hpp:23555:10: note: candidate: ‘void nlohmann::basic_json<ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer, BinaryType>::update(const_iterator, const_iterator) [with ObjectType = std::map; ArrayType = std::vector; StringType = std::__cxx11::basic_string<char>; BooleanType = bool; NumberIntegerType = long int; NumberUnsignedType = long unsigned int; NumberFloatType = double; AllocatorType = std::allocator; JSONSerializer = nlohmann::adl_serializer; BinaryType = std::vector<unsigned char>; const_iterator = nlohmann::detail::iter_impl<const nlohmann::basic_json<> >]’
23555 |     void update(const_iterator first, const_iterator last)
      |          ^~~~~~
json_nlohmann-3.10.4/single_include/nlohmann/json.hpp:23555:32: note:   no known conversion for argument 1 from ‘json’ {aka ‘nlohmann::basic_json<>’} to ‘nlohmann::basic_json<>::const_iterator’ {aka ‘nlohmann::detail::iter_impl<const nlohmann::basic_json<> >’}
23555 |     void update(const_iterator first, const_iterator last)


### Compiler and operating system

Linux SLES 15

### Library version

3.10.4

### Validation

- [ ] The bug also occurs if the latest version from the [`develop`](https://github.com/nlohmann/json/tree/develop) branch is used.
- [ ] I can successfully [compile and run the unit tests](https://github.com/nlohmann/json#execute-unit-tests).