Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Jsonize problem
Jsonize problem [message #49004] Fri, 24 November 2017 11:50 Go to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

It looks like new clone/pick approach conflicts with Jsonize internals in certain cases.
The smallest example:
#include <Core/Core.h>
using namespace Upp;

struct A : Moveable<A>
{
	struct B : Moveable<B>
	{
		struct C : Moveable<C>
		{
			int c1;
			int c2;
			double c3;
			
			void Jsonize(JsonIO& json) { json ("c1", c1) ("c2", c2) ("c3", c3); }
		};
		
		VectorMap<int, C> c;
		
		void Jsonize(JsonIO& json) { json ("c", c); }
	};
	
	VectorMap<int, B> b; // <-- VectorMap leads to compiling failed
	//Vector<B> b; // Vector compiles Ok!
	
	void Jsonize(JsonIO& json) { json ("b", b); }
};

CONSOLE_APP_MAIN
{
	A a;
}
Re: Jsonize problem [message #49005 is a reply to message #49004] Fri, 24 November 2017 12:57 Go to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

And proposed solution:
JSON.h @ 295:
map.Add(key, pick(value));
instead of
map.Add(key, value);
Previous Topic: Source code from github doesn't compile
Next Topic: A question about FileSystemInfo
Goto Forum:
  


Current Time: Fri Mar 29 13:48:41 CET 2024

Total time taken to generate the page: 0.01005 seconds