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

when using assign operator in with json object a static assertion fails.. #1055

Closed
jipr311 opened this issue Apr 16, 2018 · 3 comments
Closed
Labels
solution: proposed fix a fix for the issue has been proposed and waits for confirmation

Comments

@jipr311
Copy link

jipr311 commented Apr 16, 2018

Bug Report
suppose you have the following class:

class Point{
public:
Point();
private:
int x;
int y;
}

then if you create a point:

Point p { 100, 100 };

and do

json j = p;

then you get the error:

static assertion failed: could not find to_json() method in T's namespace
         static_assert(sizeof(BasicJsonType) == 0,
         ^

that is pretty st.forward, what is the reason of the failure?
Feature Request

  • Describe the feature in as much detail as possible.

  • Include sample usage where appropriate.

@nlohmann
Copy link
Owner

Please have a look at the documentation: https://github.com/nlohmann/json/blob/develop/README.md#arbitrary-types-conversions

@nlohmann nlohmann added the solution: proposed fix a fix for the issue has been proposed and waits for confirmation label Apr 16, 2018
@nlohmann
Copy link
Owner

@jipr311 Does the arbitrary types conversion section help you?

@nlohmann
Copy link
Owner

Can I close this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution: proposed fix a fix for the issue has been proposed and waits for confirmation
Projects
None yet
Development

No branches or pull requests

2 participants