1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

vcmi: use std::variant

This commit is contained in:
Konstantin
2023-04-15 04:33:00 +03:00
parent 8dcb041917
commit 0d35606a44
12 changed files with 131 additions and 119 deletions

View File

@@ -213,15 +213,15 @@ namespace VERMInterpreter
{};
typedef boost::variant<char, double, int, std::string> TLiteral;
typedef std::variant<char, double, int, std::string> TLiteral;
typedef boost::variant<VNIL, boost::recursive_wrapper<VNode>, VSymbol, TLiteral, ERM::Tcommand> VOption; //options in v-expression, VNIl should be the default
typedef std::variant<VNIL, boost::recursive_wrapper<VNode>, VSymbol, TLiteral, ERM::Tcommand> VOption; //options in v-expression, VNIl should be the default
template<typename T, typename SecType>
T& getAs(SecType & opt)
{
if(opt.type() == typeid(T))
return boost::get<T>(opt);
return std::get<T>(opt);
else
throw EVermScriptExecError("Wrong type!");
}