Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch_inplace assumes StringType is std::string #4134

Open
2 tasks done
tomalakgeretkal opened this issue Sep 5, 2023 · 1 comment
Open
2 tasks done

patch_inplace assumes StringType is std::string #4134

tomalakgeretkal opened this issue Sep 5, 2023 · 1 comment

Comments

@tomalakgeretkal
Copy link
Contributor

tomalakgeretkal commented Sep 5, 2023

Description

patch_inplace has several instances of get<std::string>, which breaks the build if you're using a custom string.

Reproduction steps

  • Instantiate a nlohmann::basic_json<> with a custom string type
  • Attempt to call nlohmann:basic_json<>::patch

Expected vs. actual results

Compilation fails.

Minimal code example

struct MyString;  // some compatible impl

using Value = nlohmann::basic_json<
		std::map,
		std::vector,
		MyString,
		bool,
		std::int64_t,
		std::uint64_t,
		double,
		
		std::allocator,
		nlohmann::adl_serializer,
		std::vector<std::uint8_t>
>;

Value base, patch;
base.patch(patch);

Error messages

No matching constructor for initialization of 'nlohmann::basic_json<std::map, std::vector, MyString >::json_pointer' (aka 'json_pointer< MyString >')

Compiler and operating system

Apple clang version 14.0.3 (clang-1403.0.22.14.1), macOS Ventura 13.5.1

Library version

3.11.2

Validation

@falbrechtskirchinger
Copy link
Contributor

Seems easy enough to fix. If you care to submit a PR, please add a regression test to tests/src/unit-alt-string.cpp.

tomalakgeretkal added a commit to tomalakgeretkal/nlohmann-json that referenced this issue Sep 6, 2023
tomalakgeretkal added a commit to tomalakgeretkal/nlohmann-json that referenced this issue Sep 8, 2023
tomalakgeretkal added a commit to tomalakgeretkal/nlohmann-json that referenced this issue Sep 25, 2023
tomalakgeretkal added a commit to tomalakgeretkal/nlohmann-json that referenced this issue Sep 25, 2023
tomalakgeretkal added a commit to tomalakgeretkal/nlohmann-json that referenced this issue Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants