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

scalar transforms to list #2000

Closed
toohes opened this issue Mar 19, 2020 · 4 comments
Closed

scalar transforms to list #2000

toohes opened this issue Mar 19, 2020 · 4 comments

Comments

@toohes
Copy link

toohes commented Mar 19, 2020

code:

	int i = 948;
	json scalar = i;
	std::cout << "<start>\n" << scalar.dump() << "\n<end>\n";
	json record;
	record["scalar"] = scalar;
	std::cout << "<start>\n" << record.dump() << "\n<end>\n";

g++ 7.2 output:

<start>
948
<end>
<start>
{"scalar":948} // ok
<end>

MSVC 2017 with default c++ standard setting and "ISO C++14 Standard (/std:c++14)" output:

<start>
948
<end>
<start>
{"scalar":[948]} // why list?
<end>
@nlohmann
Copy link
Owner

Is that the exact code you run or are there some brace initializations somewhere?

@toohes
Copy link
Author

toohes commented Mar 19, 2020

it is copypaste.
i spend some time for war with markdown.

@toohes
Copy link
Author

toohes commented Mar 19, 2020

ups. i've found my bug. sorry.

@toohes toohes closed this as completed Mar 19, 2020
@toohes
Copy link
Author

toohes commented Mar 19, 2020

there was wrong typedef

	typedef vr::jsn::Packet json;

where

	class Packet : public detail::json
		{
		public:
			Packet() = default;
			Packet(Packet const&) = delete;
			Packet& operator =(Packet&& p) = default;
			Packet(detail::json&& j)= default;
		};

right typedef

typedef nlohmann::json json;

has fixed bug.
nonetheless behavior of gcc and msvc is different.

remote work so remote.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants