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.