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

Error in adl_serializer #1590

Closed
frenzisys opened this issue Apr 29, 2019 · 4 comments
Closed

Error in adl_serializer #1590

frenzisys opened this issue Apr 29, 2019 · 4 comments
Labels
kind: question state: needs more info the author of the issue needs to provide more details state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@frenzisys
Copy link

frenzisys commented Apr 29, 2019

Hi!
I have a big problem and i don't know where i wrong.
i make this partial specialization for my classes:

	template <class T>
	struct adl_serializer<nia::value_t<T>> {
		static void to_json(json &j, const nia::value_t<T> &object) {
			if (object) object->toJson(j, true);
			 else  j = "";			
		}
		static void from_json(const json &j, nia::value_t<T> &object) {
			if (!object) throw "";
			else object->fromJson(j, true);			
		}
	};

Unfortunately this don't work, i have to write full specialization

	template<>
	struct adl_serializer<nia::value_t<example>> {...}

for every type of class because
nlohmann::detail::has_from_json<nlohmann::json,nia::value_t<example>>::value
don't find the generic template.

i use clang9 in qtcreator... what i wrong?

@AntonioL
Copy link

AntonioL commented May 1, 2019

I am running into a similar issue as well.

Can you advise?

@stale
Copy link

stale bot commented May 31, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label May 31, 2019
@nlohmann
Copy link
Owner

Can you provide a small working example for the type?

@stale stale bot removed the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Jun 29, 2019
@nlohmann nlohmann added the state: needs more info the author of the issue needs to provide more details label Jun 29, 2019
@stale
Copy link

stale bot commented Jul 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Jul 29, 2019
@stale stale bot closed this as completed Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: question state: needs more info the author of the issue needs to provide more details state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

3 participants