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

try to assign dumped string to a class member varible #3300

Closed
DamonsJ opened this issue Jan 27, 2022 · 1 comment
Closed

try to assign dumped string to a class member varible #3300

DamonsJ opened this issue Jan 27, 2022 · 1 comment
Labels
solution: invalid the issue is not related to the library

Comments

@DamonsJ
Copy link

DamonsJ commented Jan 27, 2022

here is my code :

class A {
public:
void func()
{
nlohmann::json j;
j["a"] = 2.0;

str = j.dump();
}
std::vector<std::string> str;
};

this code give me a crash

why?

@nlohmann
Copy link
Owner

The return value of j.dump() is a std::string. You try to assign it to a std::vector<std::string>. What do you expect here?

@nlohmann nlohmann added solution: invalid the issue is not related to the library and removed kind: bug labels Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: invalid the issue is not related to the library
Projects
None yet
Development

No branches or pull requests

2 participants