-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
kind: bugrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
What is the issue you have?
(Apologies if this should have been a discussion item and not a bug report.)
I have a JSON object and would like to extract the keys (preferably as a set
). (In jsoncpp this is accomplished with .getMemberNames()
)
Ideally this would work with range-v3, but the iterator of this library does not seem to be compatible:
json.items() | ranges::views::keys
/Projects/solidity/test/libsolidity/StandardCompiler.cpp:1255:39: error: invalid operands to binary expression ('const nlohmann::basic_json<>::value_type' (aka 'const nlohmann::basic_json<>') and 'const view_closure<ranges::views::keys_fn>')
(optimizer["details"]["yulDetails"] | ranges::views::keys | ranges::to<set>) ==
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~
ranges::subrange(json.begin(), json.end()) || ranges::views::keys
/Projects/solidity/test/libsolidity/StandardCompiler.cpp:1255:4: error: no viable constructor or deduction guide for deduction of template arguments of 'subrange'
(ranges::subrange(optimizer["details"]["yulDetails"].begin(), optimizer["details"]["yulDetails"].end()) | ranges::views::keys | ranges::to<set>) ==
^
json.items() | ranges::views::transform([](auto&& _v) { return _v.key(); })
/Projects/solidity/test/libsolidity/StandardCompiler.cpp:1254:100: error: no member named 'key' in 'nlohmann::basic_json<>'
auto x = optimizer["details"]["yulDetails"] | ranges::views::transform([](auto&& _v) { return _v.key(); });
~~ ^
Please describe the steps to reproduce the issue.
As above ^^
Can you provide a small but working code example?
What is the expected behavior?
And what is the actual behavior instead?
Which compiler and operating system are you using?
- Compiler: gcc + clang
- Operating system: linux + macOS
Which version of the library did you use?
- latest release version 3.10.4
- other release - please state the version: 3.10.2
- the
develop
branch
If you experience a compilation error: can you compile and run the unit tests?
- yes
- no - please copy/paste the error message below
Metadata
Metadata
Assignees
Labels
kind: bugrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation