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

How to set both key and value pair as variable #1511

Open
hf81-ble opened this issue Sep 18, 2023 · 0 comments
Open

How to set both key and value pair as variable #1511

hf81-ble opened this issue Sep 18, 2023 · 0 comments

Comments

@hf81-ble
Copy link

hf81-ble commented Sep 18, 2023

Describe the bug
I want to write a generic storage handler into an json file. Key and value are variables

void setSetting ( CString key, Integer value)
{
Json::Value data;
data[key] = value;
///write json
}

Result in VS2022 Compiler:
Severity Code Description Project File Line Suppression State
Error C2678 binary '[': no operator found which takes a left-hand operand of type 'Json::Value' (or there is no acceptable conversion) Editor ConfigJson.cpp 61

To Reproduce
Steps to reproduce the behavior:

  1. Use a variable as key instead of a static String

Expected behavior
should write the key/pair pair

Desktop (please complete the following information):

  • OS: Win10
  • Visual Studio 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant