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: 916
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: 916
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: Sat Feb 23 20:25:54 CET 2019

Total time taken to generate the page: 0.00828 seconds