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 » Community » Newbie corner » Value strange behaviour result in ValueTypeError
Value strange behaviour result in ValueTypeError [message #51791] Fri, 31 May 2019 01:44 Go to previous message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Hello Community,

look at this code :
#include <Core/Core.h>
using namespace Upp;

VectorMap<String,Value> ConfigurationType;

template <class T> bool testAddVector(String keyname, const T &t){
	if(ConfigurationType.Add(keyname,Value(t))) //Add t to value
		return true;
}

CONSOLE_APP_MAIN
{
	String theString = "Hello world";
	ConfigurationType.Add("test1",Value(theString)); //simply add value to vector
	Cout() << (String)ConfigurationType[0].Get<String>()<<"\n"; //Show the result from casting back the value to String
	testAddVector<String>("test2", theString); // add value from a function (Crash on it)
	//It result on Upp::ValueTypeError exception
	Cout() << (String)ConfigurationType[1].Get<String>()<<"\n"; //Code stop Before this point
}	


It result on a crash i don't get why.
Can someone explain me ?
I have put test case file below.

Thanks in advance,

Best regard.
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Memory leaks ?
Next Topic: Tricky template non-typeParameter
Goto Forum:
  


Current Time: Fri Apr 26 11:18:03 CEST 2024

Total time taken to generate the page: 0.04290 seconds