mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	vcmi: use std::variant
This commit is contained in:
		| @@ -1915,7 +1915,7 @@ void CPlayerInterface::requestReturningToMainMenu(bool won) | ||||
|  | ||||
| void CPlayerInterface::askToAssembleArtifact(const ArtifactLocation &al) | ||||
| { | ||||
| 	auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder); | ||||
| 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder); | ||||
| 	if(hero) | ||||
| 	{ | ||||
| 		auto art = hero->getArt(al.slot); | ||||
| @@ -1932,14 +1932,14 @@ void CPlayerInterface::askToAssembleArtifact(const ArtifactLocation &al) | ||||
| void CPlayerInterface::artifactPut(const ArtifactLocation &al) | ||||
| { | ||||
| 	EVENT_HANDLER_CALLED_BY_CLIENT; | ||||
| 	auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder); | ||||
| 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder); | ||||
| 	updateInfo(hero); | ||||
| } | ||||
|  | ||||
| void CPlayerInterface::artifactRemoved(const ArtifactLocation &al) | ||||
| { | ||||
| 	EVENT_HANDLER_CALLED_BY_CLIENT; | ||||
| 	auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder); | ||||
| 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder); | ||||
| 	updateInfo(hero); | ||||
| 	for(auto isa : GH.listInt) | ||||
| 	{ | ||||
| @@ -1954,7 +1954,7 @@ void CPlayerInterface::artifactRemoved(const ArtifactLocation &al) | ||||
| void CPlayerInterface::artifactMoved(const ArtifactLocation &src, const ArtifactLocation &dst) | ||||
| { | ||||
| 	EVENT_HANDLER_CALLED_BY_CLIENT; | ||||
| 	auto hero = boost::apply_visitor(HeroObjectRetriever(), dst.artHolder); | ||||
| 	auto hero = std::visit(HeroObjectRetriever(), dst.artHolder); | ||||
| 	updateInfo(hero); | ||||
|  | ||||
| 	bool redraw = true; | ||||
| @@ -1983,7 +1983,7 @@ void CPlayerInterface::bulkArtMovementStart(size_t numOfArts) | ||||
| void CPlayerInterface::artifactAssembled(const ArtifactLocation &al) | ||||
| { | ||||
| 	EVENT_HANDLER_CALLED_BY_CLIENT; | ||||
| 	auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder); | ||||
| 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder); | ||||
| 	updateInfo(hero); | ||||
| 	for(auto isa : GH.listInt) | ||||
| 	{ | ||||
| @@ -1996,7 +1996,7 @@ void CPlayerInterface::artifactAssembled(const ArtifactLocation &al) | ||||
| void CPlayerInterface::artifactDisassembled(const ArtifactLocation &al) | ||||
| { | ||||
| 	EVENT_HANDLER_CALLED_BY_CLIENT; | ||||
| 	auto hero = boost::apply_visitor(HeroObjectRetriever(), al.artHolder); | ||||
| 	auto hero = std::visit(HeroObjectRetriever(), al.artHolder); | ||||
| 	updateInfo(hero); | ||||
| 	for(auto isa : GH.listInt) | ||||
| 	{ | ||||
|   | ||||
| @@ -21,7 +21,7 @@ namespace LogicalExpressionDetail | ||||
| 	class ExpressionBase | ||||
| 	{ | ||||
| 	public: | ||||
| 		/// Possible logical operations, mostly needed to create different types for boost::variant | ||||
| 		/// Possible logical operations, mostly needed to create different types for std::variant | ||||
| 		enum EOperations | ||||
| 		{ | ||||
| 			ANY_OF, | ||||
| @@ -37,7 +37,7 @@ namespace LogicalExpressionDetail | ||||
| 		typedef ContainedClass Value; | ||||
|  | ||||
| 		/// Variant that contains all possible elements from logical expression | ||||
| 		typedef boost::variant< | ||||
| 		typedef std::variant< | ||||
| 			OperatorAll, | ||||
| 			OperatorAny, | ||||
| 			OperatorNone, | ||||
| @@ -81,7 +81,7 @@ namespace LogicalExpressionDetail | ||||
| 		{ | ||||
| 			return boost::range::count_if(element, [&](const typename Base::Variant & expr) | ||||
| 			{ | ||||
| 				return boost::apply_visitor(*this, expr); | ||||
| 				return std::visit(*this, expr); | ||||
| 			}); | ||||
| 		} | ||||
| 	public: | ||||
| @@ -131,7 +131,7 @@ namespace LogicalExpressionDetail | ||||
| 		{ | ||||
| 			return boost::range::count_if(element, [&](const typename Base::Variant & expr) | ||||
| 			{ | ||||
| 				return boost::apply_visitor(*satisfiabilityVisitor, expr); | ||||
| 				return std::visit(*satisfiabilityVisitor, expr); | ||||
| 			}); | ||||
| 		} | ||||
|  | ||||
| @@ -139,7 +139,7 @@ namespace LogicalExpressionDetail | ||||
| 		{ | ||||
| 			return boost::range::count_if(element, [&](const typename Base::Variant & expr) | ||||
| 			{ | ||||
| 				return boost::apply_visitor(*falsifiabilityVisitor, expr); | ||||
| 				return std::visit(*falsifiabilityVisitor, expr); | ||||
| 			}); | ||||
| 		} | ||||
|  | ||||
| @@ -254,7 +254,7 @@ namespace LogicalExpressionDetail | ||||
| 			if (!classTest(element)) | ||||
| 			{ | ||||
| 				for (auto & elem : element.expressions) | ||||
| 					boost::range::copy(boost::apply_visitor(*this, elem), std::back_inserter(ret)); | ||||
| 					boost::range::copy(std::visit(*this, elem), std::back_inserter(ret)); | ||||
| 			} | ||||
| 			return ret; | ||||
| 		} | ||||
| @@ -265,7 +265,7 @@ namespace LogicalExpressionDetail | ||||
| 			if (!classTest(element)) | ||||
| 			{ | ||||
| 				for (auto & elem : element.expressions) | ||||
| 					boost::range::copy(boost::apply_visitor(*this, elem), std::back_inserter(ret)); | ||||
| 					boost::range::copy(std::visit(*this, elem), std::back_inserter(ret)); | ||||
| 			} | ||||
| 			return ret; | ||||
| 		} | ||||
| @@ -306,7 +306,7 @@ namespace LogicalExpressionDetail | ||||
| 		typename Base::Variant operator()(Type element) const | ||||
| 		{ | ||||
| 			for (auto & entry : element.expressions) | ||||
| 				entry = boost::apply_visitor(*this, entry); | ||||
| 				entry = std::visit(*this, entry); | ||||
| 			return element; | ||||
| 		} | ||||
| 	}; | ||||
| @@ -330,15 +330,15 @@ namespace LogicalExpressionDetail | ||||
|  | ||||
| 			for (auto & entryRO : element.expressions) | ||||
| 			{ | ||||
| 				auto entry = boost::apply_visitor(*this, entryRO); | ||||
| 				auto entry = std::visit(*this, entryRO); | ||||
|  | ||||
| 				try | ||||
| 				{ | ||||
| 					// copy entries from child of this type | ||||
| 					auto sublist = boost::get<Type>(entry).expressions; | ||||
| 					auto sublist = std::get<Type>(entry).expressions; | ||||
| 					std::move(sublist.begin(), sublist.end(), std::back_inserter(ret.expressions)); | ||||
| 				} | ||||
| 				catch (boost::bad_get &) | ||||
| 				catch (std::bad_variant_access &) | ||||
| 				{ | ||||
| 					// different type (e.g. allOf vs oneOf) just copy | ||||
| 					ret.expressions.push_back(entry); | ||||
| @@ -410,7 +410,7 @@ namespace LogicalExpressionDetail | ||||
| 			ret.Vector().resize(1); | ||||
| 			ret.Vector().back().String() = name; | ||||
| 			for (auto & expr : element) | ||||
| 				ret.Vector().push_back(boost::apply_visitor(*this, expr)); | ||||
| 				ret.Vector().push_back(std::visit(*this, expr)); | ||||
| 			return ret; | ||||
| 		} | ||||
| 	public: | ||||
| @@ -465,7 +465,7 @@ namespace LogicalExpressionDetail | ||||
| 			std::string ret; | ||||
| 			prefix.push_back('\t'); | ||||
| 			for (auto & expr : element) | ||||
| 				ret += prefix + boost::apply_visitor(*this, expr) + "\n"; | ||||
| 				ret += prefix + std::visit(*this, expr) + "\n"; | ||||
| 			prefix.pop_back(); | ||||
| 			return ret; | ||||
| 		} | ||||
| @@ -552,14 +552,14 @@ public: | ||||
| 	Variant morph(std::function<Variant(const Value &)> morpher) const | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::ForEachVisitor<Value> visitor(morpher); | ||||
| 		return boost::apply_visitor(visitor, data); | ||||
| 		return std::visit(visitor, data); | ||||
| 	} | ||||
|  | ||||
| 	/// Minimizes expression, removing any redundant elements | ||||
| 	void minimize() | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::MinimizingVisitor<Value> visitor; | ||||
| 		data = boost::apply_visitor(visitor, data); | ||||
| 		data = std::visit(visitor, data); | ||||
| 	} | ||||
|  | ||||
| 	/// calculates if expression evaluates to "true". | ||||
| @@ -567,7 +567,7 @@ public: | ||||
| 	bool test(std::function<bool(const Value &)> toBool) const | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::TestVisitor<Value> testVisitor(toBool); | ||||
| 		return boost::apply_visitor(testVisitor, data); | ||||
| 		return std::visit(testVisitor, data); | ||||
| 	} | ||||
|  | ||||
| 	/// calculates if expression can evaluate to "true". | ||||
| @@ -579,7 +579,7 @@ public: | ||||
| 		satisfiabilityVisitor.setFalsifiabilityVisitor(&falsifiabilityVisitor); | ||||
| 		falsifiabilityVisitor.setSatisfiabilityVisitor(&satisfiabilityVisitor); | ||||
|  | ||||
| 		return boost::apply_visitor(satisfiabilityVisitor, data); | ||||
| 		return std::visit(satisfiabilityVisitor, data); | ||||
| 	} | ||||
|  | ||||
| 	/// calculates if expression can evaluate to "false". | ||||
| @@ -591,14 +591,14 @@ public: | ||||
| 		satisfiabilityVisitor.setFalsifiabilityVisitor(&falsifiabilityVisitor); | ||||
| 		falsifiabilityVisitor.setFalsifiabilityVisitor(&satisfiabilityVisitor); | ||||
|  | ||||
| 		return boost::apply_visitor(falsifiabilityVisitor, data); | ||||
| 		return std::visit(falsifiabilityVisitor, data); | ||||
| 	} | ||||
|  | ||||
| 	/// generates list of candidates that can be fulfilled by caller (like AI) | ||||
| 	std::vector<Value> getFulfillmentCandidates(std::function<bool(const Value &)> toBool) const | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::CandidatesVisitor<Value> candidateVisitor(toBool); | ||||
| 		return boost::apply_visitor(candidateVisitor, data); | ||||
| 		return std::visit(candidateVisitor, data); | ||||
| 	} | ||||
|  | ||||
| 	/// Converts expression in human-readable form | ||||
| @@ -607,18 +607,18 @@ public: | ||||
| 	std::string toString(std::function<std::string(const Value &)> toStr) const | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::Printer<Value> printVisitor(toStr); | ||||
| 		return boost::apply_visitor(printVisitor, data); | ||||
| 		return std::visit(printVisitor, data); | ||||
| 	} | ||||
| 	std::string toString(std::function<std::string(const Value &)> toStr, std::function<bool(const Value &)> toBool) const | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::Printer<Value> printVisitor(toStr, toBool); | ||||
| 		return boost::apply_visitor(printVisitor, data); | ||||
| 		return std::visit(printVisitor, data); | ||||
| 	} | ||||
|  | ||||
| 	JsonNode toJson(std::function<JsonNode(const Value &)> toJson) const | ||||
| 	{ | ||||
| 		LogicalExpressionDetail::Writer<Value> writeVisitor(toJson); | ||||
| 		return boost::apply_visitor(writeVisitor, data); | ||||
| 		return std::visit(writeVisitor, data); | ||||
| 	} | ||||
|  | ||||
| 	template <typename Handler> | ||||
|   | ||||
| @@ -233,7 +233,7 @@ struct Component | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| using TArtHolder = boost::variant<ConstTransitivePtr<CGHeroInstance>, ConstTransitivePtr<CStackInstance>>; | ||||
| using TArtHolder = std::variant<ConstTransitivePtr<CGHeroInstance>, ConstTransitivePtr<CStackInstance>>; | ||||
|  | ||||
| struct ArtifactLocation | ||||
| { | ||||
| @@ -259,9 +259,9 @@ struct ArtifactLocation | ||||
| 	template <typename T> | ||||
| 	bool isHolder(const T *t) const | ||||
| 	{ | ||||
| 		if(auto ptrToT = boost::get<ConstTransitivePtr<T> >(&artHolder)) | ||||
| 		if(auto ptrToT = std::get<ConstTransitivePtr<T>>(artHolder)) | ||||
| 		{ | ||||
| 			return ptrToT->get() == t; | ||||
| 			return ptrToT == t; | ||||
| 		} | ||||
| 		return false; | ||||
| 	} | ||||
|   | ||||
| @@ -1563,7 +1563,7 @@ void ArtifactLocation::removeArtifact() | ||||
|  | ||||
| const CArmedInstance * ArtifactLocation::relatedObj() const | ||||
| { | ||||
| 	return boost::apply_visitor(ObjectRetriever(), artHolder); | ||||
| 	return std::visit(ObjectRetriever(), artHolder); | ||||
| } | ||||
|  | ||||
| PlayerColor ArtifactLocation::owningPlayer() const | ||||
| @@ -1574,12 +1574,12 @@ PlayerColor ArtifactLocation::owningPlayer() const | ||||
|  | ||||
| CArtifactSet *ArtifactLocation::getHolderArtSet() | ||||
| { | ||||
| 	return boost::apply_visitor(GetBase<CArtifactSet>(), artHolder); | ||||
| 	return std::visit(GetBase<CArtifactSet>(), artHolder); | ||||
| } | ||||
|  | ||||
| CBonusSystemNode *ArtifactLocation::getHolderNode() | ||||
| { | ||||
| 	return boost::apply_visitor(GetBase<CBonusSystemNode>(), artHolder); | ||||
| 	return std::visit(GetBase<CBonusSystemNode>(), artHolder); | ||||
| } | ||||
|  | ||||
| const CArtifactInstance *ArtifactLocation::getArt() const | ||||
| @@ -2533,12 +2533,12 @@ const CArtifactInstance * ArtSlotInfo::getArt() const | ||||
|  | ||||
| CArtifactSet * BulkMoveArtifacts::getSrcHolderArtSet() | ||||
| { | ||||
| 	return boost::apply_visitor(GetBase<CArtifactSet>(), srcArtHolder); | ||||
| 	return std::visit(GetBase<CArtifactSet>(), srcArtHolder); | ||||
| } | ||||
|  | ||||
| CArtifactSet * BulkMoveArtifacts::getDstHolderArtSet() | ||||
| { | ||||
| 	return boost::apply_visitor(GetBase<CArtifactSet>(), dstArtHolder); | ||||
| 	return std::visit(GetBase<CArtifactSet>(), dstArtHolder); | ||||
| } | ||||
|  | ||||
| VCMI_LIB_NAMESPACE_END | ||||
|   | ||||
| @@ -9,6 +9,7 @@ | ||||
|  */ | ||||
| #pragma once | ||||
|  | ||||
| #include <boost/mpl/vector.hpp> | ||||
| #include <boost/mpl/for_each.hpp> | ||||
|  | ||||
| #include "CTypeList.h" | ||||
| @@ -43,10 +44,21 @@ class DLL_LINKAGE BinaryDeserializer : public CLoaderBase | ||||
| 		Source & source; | ||||
| 		std::vector<std::function<Variant()>> funcs; | ||||
|  | ||||
| 		template <class V> | ||||
| 		struct mpl_types_impl; | ||||
|  | ||||
| 		template <class... Ts> | ||||
| 		struct mpl_types_impl<std::variant<Ts...>> { | ||||
| 			using type = boost::mpl::vector<Ts...>; | ||||
| 		}; | ||||
|  | ||||
| 		template <class V> | ||||
| 		using mpl_types = typename mpl_types_impl<V>::type; | ||||
|  | ||||
| 		VariantLoaderHelper(Source & source): | ||||
| 			source(source) | ||||
| 		{ | ||||
| 			boost::mpl::for_each<typename Variant::types>(std::ref(*this)); | ||||
| 			boost::mpl::for_each<mpl_types<Variant>>(std::ref(*this)); | ||||
| 		} | ||||
|  | ||||
| 		template<typename Type> | ||||
| @@ -495,9 +507,9 @@ public: | ||||
| 	} | ||||
|  | ||||
| 	template <BOOST_VARIANT_ENUM_PARAMS(typename T)> | ||||
| 	void load(boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> &data) | ||||
| 	void load(std::variant<BOOST_VARIANT_ENUM_PARAMS(T)> &data) | ||||
| 	{ | ||||
| 		typedef boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> TVariant; | ||||
| 		typedef std::variant<BOOST_VARIANT_ENUM_PARAMS(T)> TVariant; | ||||
|  | ||||
| 		VariantLoaderHelper<TVariant, BinaryDeserializer> loader(*this); | ||||
|  | ||||
|   | ||||
| @@ -331,13 +331,13 @@ public: | ||||
| 		} | ||||
| 	} | ||||
| 	template <BOOST_VARIANT_ENUM_PARAMS(typename T)> | ||||
| 	void save(const boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> &data) | ||||
| 	void save(const std::variant<BOOST_VARIANT_ENUM_PARAMS(T)> &data) | ||||
| 	{ | ||||
| 		si32 which = data.which(); | ||||
| 		si32 which = data.index(); | ||||
| 		save(which); | ||||
|  | ||||
| 		VariantVisitorSaver<BinarySerializer> visitor(*this); | ||||
| 		boost::apply_visitor(visitor, data); | ||||
| 		std::visit(visitor, data); | ||||
| 	} | ||||
| 	template <typename T> | ||||
| 	void save(const boost::optional<T> &data) | ||||
|   | ||||
| @@ -185,7 +185,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		Variable operator()(const TVarExp & var) const | ||||
| 		{ | ||||
| 			return boost::apply_visitor(LVL2IexpToVar(), var); | ||||
| 			return std::visit(LVL2IexpToVar(), var); | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| @@ -196,8 +196,8 @@ namespace ERMConverter | ||||
|  | ||||
| 		std::string operator()(const TComparison & cmp) const | ||||
| 		{ | ||||
| 			Variable lhs = boost::apply_visitor(LVL1IexpToVar(), cmp.lhs); | ||||
| 			Variable rhs = boost::apply_visitor(LVL1IexpToVar(), cmp.rhs); | ||||
| 			Variable lhs = std::visit(LVL1IexpToVar(), cmp.lhs); | ||||
| 			Variable rhs = std::visit(LVL1IexpToVar(), cmp.rhs); | ||||
|  | ||||
| 			auto sign = CMP_OPERATION.find(cmp.compSign); | ||||
| 			if(sign == std::end(CMP_OPERATION)) | ||||
| @@ -314,7 +314,7 @@ namespace ERMConverter | ||||
| 			ret.isInput = false; | ||||
| 			ret.semi = true; | ||||
| 			ret.semiCmpSign = cmp.compSign; | ||||
| 			ret.name = (boost::apply_visitor(LVL1IexpToVar(), cmp.rhs)).str(); | ||||
| 			ret.name = (std::visit(LVL1IexpToVar(), cmp.rhs)).str(); | ||||
| 			return ret; | ||||
| 		} | ||||
|  | ||||
| @@ -327,7 +327,7 @@ namespace ERMConverter | ||||
| 		{ | ||||
| 			ParamIO ret; | ||||
| 			ret.isInput = true; | ||||
| 			ret.name = (boost::apply_visitor(LVL1IexpToVar(), cmp)).str();; | ||||
| 			ret.name = (std::visit(LVL1IexpToVar(), cmp)).str();; | ||||
| 			return ret; | ||||
| 		} | ||||
|  | ||||
| @@ -336,7 +336,7 @@ namespace ERMConverter | ||||
| 			ParamIO ret; | ||||
| 			ret.isInput = false; | ||||
|  | ||||
| 			ret.name = (boost::apply_visitor(LVL2IexpToVar(), cmp.var)).str(); | ||||
| 			ret.name = (std::visit(LVL2IexpToVar(), cmp.var)).str(); | ||||
| 			return ret; | ||||
| 		} | ||||
|  | ||||
| @@ -399,7 +399,7 @@ namespace ERMConverter | ||||
| 			if(trig.params.is_initialized()) | ||||
| 			{ | ||||
| 				for(auto & p : trig.params.get()) | ||||
| 					optionParams.push_back(boost::apply_visitor(BodyOption(), p)); | ||||
| 					optionParams.push_back(std::visit(BodyOption(), p)); | ||||
| 			} | ||||
|  | ||||
| 			int idx = 1; | ||||
| @@ -511,7 +511,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		FU(std::ostream * out_, const ERM::TIexp & tid) | ||||
| 			: Receiver(out_), | ||||
| 			v(boost::apply_visitor(LVL1IexpToVar(), tid)) | ||||
| 			v(std::visit(LVL1IexpToVar(), tid)) | ||||
| 		{ | ||||
| 		} | ||||
|  | ||||
| @@ -558,7 +558,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		MC(std::ostream * out_, const ERM::TIexp & tid) | ||||
| 			: Receiver(out_), | ||||
| 			v(boost::apply_visitor(LVL1IexpToVar(), tid)) | ||||
| 			v(std::visit(LVL1IexpToVar(), tid)) | ||||
| 		{ | ||||
| 		} | ||||
|  | ||||
| @@ -580,7 +580,7 @@ namespace ERMConverter | ||||
| 					{ | ||||
| 						for(auto & p : option.params.get()) | ||||
| 						{ | ||||
| 							std::string macroName = boost::apply_visitor(MC_S(), p); | ||||
| 							std::string macroName = std::visit(MC_S(), p); | ||||
|  | ||||
| 							boost::format callFormat; | ||||
|  | ||||
| @@ -616,7 +616,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		std::string operator()(const TIexp & cmp) const override | ||||
| 		{ | ||||
| 			auto v = boost::apply_visitor(LVL1IexpToVar(), cmp); | ||||
| 			auto v = std::visit(LVL1IexpToVar(), cmp); | ||||
| 			return v.str(); | ||||
| 		} | ||||
| 		std::string operator()(const TStringConstant & cmp) const override | ||||
| @@ -636,7 +636,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		std::string operator()(const TIexp & cmp) const override | ||||
| 		{ | ||||
| 			Variable p = boost::apply_visitor(LVL1IexpToVar(), cmp); | ||||
| 			Variable p = std::visit(LVL1IexpToVar(), cmp); | ||||
|  | ||||
| 			if(p.index <= 0) | ||||
| 				throw EScriptExecError("VR:H requires flag index"); | ||||
| @@ -661,7 +661,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		std::string operator()(const TIexp & cmp) const override | ||||
| 		{ | ||||
| 			Variable p = boost::apply_visitor(LVL1IexpToVar(), cmp); | ||||
| 			Variable p = std::visit(LVL1IexpToVar(), cmp); | ||||
|  | ||||
| 			return p.str(); | ||||
| 		} | ||||
| @@ -673,7 +673,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		VR(std::ostream * out_, const ERM::TIexp & tid) | ||||
| 			: Receiver(out_), | ||||
| 			v(boost::apply_visitor(LVL1IexpToVar(), tid)) | ||||
| 			v(std::visit(LVL1IexpToVar(), tid)) | ||||
| 		{ | ||||
| 		} | ||||
|  | ||||
| @@ -681,7 +681,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		void operator()(const TVRLogic & trig) const override | ||||
| 		{ | ||||
| 			Variable rhs = boost::apply_visitor(LVL1IexpToVar(), trig.var); | ||||
| 			Variable rhs = std::visit(LVL1IexpToVar(), trig.var); | ||||
|  | ||||
| 			std::string opcode; | ||||
|  | ||||
| @@ -705,7 +705,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		void operator()(const TVRArithmetic & trig) const override | ||||
| 		{ | ||||
| 			Variable rhs = boost::apply_visitor(LVL1IexpToVar(), trig.rhs); | ||||
| 			Variable rhs = std::visit(LVL1IexpToVar(), trig.rhs); | ||||
|  | ||||
| 			std::string opcode; | ||||
|  | ||||
| @@ -746,7 +746,7 @@ namespace ERMConverter | ||||
| 					if(trig.params.is_initialized()) | ||||
| 					{ | ||||
| 						for(auto & p : trig.params.get()) | ||||
| 							optionParams.push_back(boost::apply_visitor(BodyOption(), p)); | ||||
| 							optionParams.push_back(std::visit(BodyOption(), p)); | ||||
| 					} | ||||
|  | ||||
| 					auto index = v.index; | ||||
| @@ -768,7 +768,7 @@ namespace ERMConverter | ||||
| 					if(!trig.params.is_initialized() || trig.params.get().size() != 1) | ||||
| 						throw EScriptExecError("VR:H option takes exactly 1 parameter!"); | ||||
|  | ||||
| 					std::string opt = boost::apply_visitor(VR_H(), trig.params.get()[0]); | ||||
| 					std::string opt = std::visit(VR_H(), trig.params.get()[0]); | ||||
| 					boost::format fmt("ERM.VR(%s):H(%s)"); | ||||
| 					fmt % v.str() % opt; | ||||
| 					putLine(fmt.str()); | ||||
| @@ -779,7 +779,7 @@ namespace ERMConverter | ||||
| 					if(!trig.params.is_initialized() || trig.params.get().size() != 1) | ||||
| 						throw EScriptExecError("VR:H/U need 1 parameter!"); | ||||
|  | ||||
| 					std::string opt = boost::apply_visitor(VR_S(), trig.params.get()[0]); | ||||
| 					std::string opt = std::visit(VR_S(), trig.params.get()[0]); | ||||
| 					boost::format fmt("ERM.VR(%s):%c(%s)"); | ||||
| 					fmt % v.str() % (trig.optionCode) % opt; | ||||
| 					putLine(fmt.str()); | ||||
| @@ -790,7 +790,7 @@ namespace ERMConverter | ||||
| 					if(!trig.params.is_initialized() || trig.params.get().size() < 2) | ||||
| 						throw EScriptExecError("VR:M needs at least 2 parameters!"); | ||||
|  | ||||
| 					std::string opt = boost::apply_visitor(VR_X(), trig.params.get()[0]); | ||||
| 					std::string opt = std::visit(VR_X(), trig.params.get()[0]); | ||||
| 					int paramIndex = 1; | ||||
|  | ||||
| 					if(opt == "3") | ||||
| @@ -801,7 +801,7 @@ namespace ERMConverter | ||||
| 					} | ||||
| 					else | ||||
| 					{ | ||||
| 						auto target = boost::apply_visitor(VR_X(), trig.params.get()[paramIndex++]); | ||||
| 						auto target = std::visit(VR_X(), trig.params.get()[paramIndex++]); | ||||
|  | ||||
| 						boost::format fmt("%s = ERM.VR(%s):M%s("); | ||||
| 						fmt % target % v.str() % opt; | ||||
| @@ -810,7 +810,7 @@ namespace ERMConverter | ||||
| 					 | ||||
| 					for(int i = paramIndex; i < trig.params.get().size(); i++) | ||||
| 					{ | ||||
| 						opt = boost::apply_visitor(VR_X(), trig.params.get()[i]); | ||||
| 						opt = std::visit(VR_X(), trig.params.get()[i]); | ||||
| 						if(i > paramIndex) put(","); | ||||
| 						put(opt); | ||||
| 					} | ||||
| @@ -823,7 +823,7 @@ namespace ERMConverter | ||||
| 					if(!trig.params.is_initialized() || trig.params.get().size() != 1) | ||||
| 						throw EScriptExecError("VR:X option takes exactly 1 parameter!"); | ||||
|  | ||||
| 					std::string opt = boost::apply_visitor(VR_X(), trig.params.get()[0]); | ||||
| 					std::string opt = std::visit(VR_X(), trig.params.get()[0]); | ||||
|  | ||||
| 					boost::format fmt("%s = bit.bxor(%s, %s)"); | ||||
| 					fmt % v.str() % v.str() % opt;putLine(fmt.str()); | ||||
| @@ -840,7 +840,7 @@ namespace ERMConverter | ||||
| 					if(!trig.params.is_initialized() || trig.params.get().size() != 1) | ||||
| 						throw EScriptExecError("VR:S option takes exactly 1 parameter!"); | ||||
|  | ||||
| 					std::string opt = boost::apply_visitor(VR_S(), trig.params.get()[0]); | ||||
| 					std::string opt = std::visit(VR_S(), trig.params.get()[0]); | ||||
| 					put(v.str()); | ||||
| 					put(" = "); | ||||
| 					put(opt); | ||||
| @@ -858,7 +858,7 @@ namespace ERMConverter | ||||
| 					if(!trig.params.is_initialized() || trig.params.get().size() != 1) | ||||
| 						throw EScriptExecError("VR:V option takes exactly 1 parameter!"); | ||||
|  | ||||
| 					std::string opt = boost::apply_visitor(VR_X(), trig.params.get()[0]); | ||||
| 					std::string opt = std::visit(VR_X(), trig.params.get()[0]); | ||||
| 					boost::format fmt("%s = tostring(%s)"); | ||||
| 					fmt % v.str() % opt; | ||||
| 					putLine(fmt.str()); | ||||
| @@ -886,7 +886,7 @@ namespace ERMConverter | ||||
| 				const ERM::Tbody & bo = body.get(); | ||||
| 				for(int g=0; g<bo.size(); ++g) | ||||
| 				{ | ||||
| 					boost::apply_visitor(visitor, bo[g]); | ||||
| 					std::visit(visitor, bo[g]); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| @@ -915,11 +915,11 @@ namespace ERMConverter | ||||
|  | ||||
| 				if(argc > 0) | ||||
| 				{ | ||||
| 					std::string loopCounter = (boost::apply_visitor(LVL1IexpToVar(), tid.at(0))).str(); | ||||
| 					std::string loopCounter = (std::visit(LVL1IexpToVar(), tid.at(0))).str(); | ||||
|  | ||||
| 					std::string startVal = argc > 1 ? (boost::apply_visitor(LVL1IexpToVar(), tid.at(1))).str() : loopCounter; | ||||
| 					std::string stopVal = argc > 2 ? (boost::apply_visitor(LVL1IexpToVar(), tid.at(2))).str() : loopCounter; | ||||
| 					std::string increment = argc > 3 ? (boost::apply_visitor(LVL1IexpToVar(), tid.at(3))).str() : "1"; | ||||
| 					std::string startVal = argc > 1 ? (std::visit(LVL1IexpToVar(), tid.at(1))).str() : loopCounter; | ||||
| 					std::string stopVal = argc > 2 ? (std::visit(LVL1IexpToVar(), tid.at(2))).str() : loopCounter; | ||||
| 					std::string increment = argc > 3 ? (std::visit(LVL1IexpToVar(), tid.at(3))).str() : "1"; | ||||
|  | ||||
| 					boost::format fmt("for __iter = %s, %s, %s do"); | ||||
|  | ||||
| @@ -962,7 +962,7 @@ namespace ERMConverter | ||||
| 				{ | ||||
| 					for(const auto & id : identifier.get()) | ||||
| 					{ | ||||
| 						Variable v = boost::apply_visitor(LVL1IexpToVar(), id); | ||||
| 						Variable v = std::visit(LVL1IexpToVar(), id); | ||||
|  | ||||
| 						if(v.isSpecial()) | ||||
| 							throw ELineProblem("Special variable syntax ('d') is not allowed in receiver identifier"); | ||||
| @@ -1018,7 +1018,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		void convertConditionInner(const Tcondition & cond, char op) const | ||||
| 		{ | ||||
| 			std::string lhs = boost::apply_visitor(Condition(), cond.cond); | ||||
| 			std::string lhs = std::visit(Condition(), cond.cond); | ||||
|  | ||||
| 			if(cond.ctype != '/') | ||||
| 				op = cond.ctype; | ||||
| @@ -1057,7 +1057,7 @@ namespace ERMConverter | ||||
| 		void convertCondition(const Tcondition & cond) const | ||||
| 		{ | ||||
| 			//&c1/c2/c3|c4/c5/c6 -> (c1  & c2  & c3)  | c4  |  c5  | c6 | ||||
| 			std::string lhs = boost::apply_visitor(Condition(), cond.cond); | ||||
| 			std::string lhs = std::visit(Condition(), cond.cond); | ||||
| 			put("if "); | ||||
| 			put(lhs); | ||||
|  | ||||
| @@ -1143,7 +1143,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		void operator()(const Tcommand & cmd) const | ||||
| 		{ | ||||
| 			boost::apply_visitor(ERMExp(out), cmd.cmd); | ||||
| 			std::visit(ERMExp(out), cmd.cmd); | ||||
| 		} | ||||
| 		void operator()(const std::string & comment) const | ||||
| 		{ | ||||
| @@ -1196,7 +1196,7 @@ namespace ERMConverter | ||||
| 		void operator()(TLiteral const & opt) const | ||||
| 		{ | ||||
| 			TLiteralEval tmp; | ||||
| 			(*out) << boost::apply_visitor(tmp, opt); | ||||
| 			(*out) << std::visit(tmp, opt); | ||||
| 		} | ||||
| 		void operator()(ERM::Tcommand const & opt) const | ||||
| 		{ | ||||
| @@ -1204,7 +1204,7 @@ namespace ERMConverter | ||||
| 			//TODO: can we evaluate to smth more useful? | ||||
| 			//??? | ||||
| 			throw EVermScriptExecError("Using ERM options in VERM expression is not (yet) allowed"); | ||||
| //			boost::apply_visitor(ERMExp(out), opt.cmd); | ||||
| //			std::visit(ERMExp(out), opt.cmd); | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| @@ -1216,7 +1216,7 @@ namespace ERMConverter | ||||
|  | ||||
| 		for(VOption & op : tmpn.children) | ||||
| 		{ | ||||
| 			boost::apply_visitor(VOptionEval(out), op); | ||||
| 			std::visit(VOptionEval(out), op); | ||||
| 			(*out) << ","; | ||||
| 		} | ||||
| 		(*out) << "}"; | ||||
| @@ -1242,7 +1242,7 @@ namespace ERMConverter | ||||
| 		} | ||||
| 		void operator()(TERMline const & cmd) const | ||||
| 		{ | ||||
| 			boost::apply_visitor(Command(out), cmd); | ||||
| 			std::visit(Command(out), cmd); | ||||
| 		} | ||||
| 	}; | ||||
|  | ||||
| @@ -1257,7 +1257,7 @@ namespace ERMConverter | ||||
| 		{ | ||||
| 			ERM::TLine & line = owner->retrieveLine(lp); | ||||
|  | ||||
| 			boost::apply_visitor(lineConverter, line); | ||||
| 			std::visit(lineConverter, line); | ||||
| 		} | ||||
|  | ||||
| 		out << "end" << std::endl; | ||||
| @@ -1285,7 +1285,7 @@ namespace ERMConverter | ||||
| 			if(tid.empty()) | ||||
| 				throw EInterpreterError("Function must have identifier"); | ||||
|  | ||||
| 			Variable v = boost::apply_visitor(LVL1IexpToVar(), tid[0]); | ||||
| 			Variable v = std::visit(LVL1IexpToVar(), tid[0]); | ||||
|  | ||||
| 			if(v.isSpecial()) | ||||
| 				throw ELineProblem("Special variable syntax ('d') is not allowed in function definition"); | ||||
| @@ -1304,7 +1304,7 @@ namespace ERMConverter | ||||
| 				if(owner->isATrigger(curLine)) | ||||
| 					break; | ||||
|  | ||||
| 				boost::apply_visitor(lineConverter, curLine); | ||||
| 				std::visit(lineConverter, curLine); | ||||
| 			} | ||||
|  | ||||
| 			out << "end," << std::endl; | ||||
| @@ -1332,7 +1332,7 @@ namespace ERMConverter | ||||
| 			{ | ||||
| 				for(const auto & id : trig.identifier.get()) | ||||
| 				{ | ||||
| 					Variable v = boost::apply_visitor(LVL1IexpToVar(), id); | ||||
| 					Variable v = std::visit(LVL1IexpToVar(), id); | ||||
|  | ||||
| 					if(v.isSpecial()) | ||||
| 						throw ELineProblem("Special variable syntax ('d') is not allowed in trigger definition"); | ||||
| @@ -1358,7 +1358,7 @@ namespace ERMConverter | ||||
| 				if(owner->isATrigger(curLine)) | ||||
| 					break; | ||||
|  | ||||
| 				boost::apply_visitor(lineConverter, curLine); | ||||
| 				std::visit(lineConverter, curLine); | ||||
| 			} | ||||
|  | ||||
| 			out << "end," << std::endl; | ||||
| @@ -1383,14 +1383,14 @@ struct ScriptScanner : boost::static_visitor<> | ||||
| 	{ | ||||
| 		if(cmd.which() == 0) //TCommand | ||||
| 		{ | ||||
| 			Tcommand tcmd = boost::get<Tcommand>(cmd); | ||||
| 			Tcommand tcmd = std::get<Tcommand>(cmd); | ||||
| 			switch (tcmd.cmd.which()) | ||||
| 			{ | ||||
| 			case 0: //trigger | ||||
| 				{ | ||||
| 					Trigger trig; | ||||
| 					trig.line = lp; | ||||
| 					interpreter->triggers[ TriggerType(boost::get<ERM::Ttrigger>(tcmd.cmd).name) ].push_back(trig); | ||||
| 					interpreter->triggers[ TriggerType(std::get<ERM::Ttrigger>(tcmd.cmd).name) ].push_back(trig); | ||||
| 				} | ||||
| 				break; | ||||
| 			case 1: //instruction | ||||
| @@ -1402,7 +1402,7 @@ struct ScriptScanner : boost::static_visitor<> | ||||
| 				{ | ||||
| 					Trigger trig; | ||||
| 					trig.line = lp; | ||||
| 					interpreter->postTriggers[ TriggerType(boost::get<ERM::TPostTrigger>(tcmd.cmd).name) ].push_back(trig); | ||||
| 					interpreter->postTriggers[ TriggerType(std::get<ERM::TPostTrigger>(tcmd.cmd).name) ].push_back(trig); | ||||
| 				} | ||||
| 				break; | ||||
| 			default: | ||||
| @@ -1431,7 +1431,7 @@ bool ERMInterpreter::isATrigger( const ERM::TLine & line ) | ||||
| 	{ | ||||
| 	case 0: //v-exp | ||||
| 		{ | ||||
| 			TVExp vexp = boost::get<TVExp>(line); | ||||
| 			TVExp vexp = std::get<TVExp>(line); | ||||
| 			if(vexp.children.empty()) | ||||
| 				return false; | ||||
|  | ||||
| @@ -1441,7 +1441,7 @@ bool ERMInterpreter::isATrigger( const ERM::TLine & line ) | ||||
| 				return false; | ||||
| 				break; | ||||
| 			case TCMD: | ||||
| 				return isCMDATrigger( boost::get<ERM::Tcommand>(vexp.children[0]) ); | ||||
| 				return isCMDATrigger( std::get<ERM::Tcommand>(vexp.children[0]) ); | ||||
| 				break; | ||||
| 			default: | ||||
| 				return false; | ||||
| @@ -1451,11 +1451,11 @@ bool ERMInterpreter::isATrigger( const ERM::TLine & line ) | ||||
| 		break; | ||||
| 	case 1: //erm | ||||
| 		{ | ||||
| 			TERMline ermline = boost::get<TERMline>(line); | ||||
| 			TERMline ermline = std::get<TERMline>(line); | ||||
| 			switch(ermline.which()) | ||||
| 			{ | ||||
| 			case 0: //tcmd | ||||
| 				return isCMDATrigger( boost::get<ERM::Tcommand>(ermline) ); | ||||
| 				return isCMDATrigger( std::get<ERM::Tcommand>(ermline) ); | ||||
| 				break; | ||||
| 			default: | ||||
| 				return false; | ||||
| @@ -1500,17 +1500,17 @@ ERM::TTriggerBase & ERMInterpreter::retrieveTrigger(ERM::TLine & line) | ||||
| { | ||||
| 	if(line.which() == 1) | ||||
| 	{ | ||||
| 		ERM::TERMline &tl = boost::get<ERM::TERMline>(line); | ||||
| 		ERM::TERMline &tl = std::get<ERM::TERMline>(line); | ||||
| 		if(tl.which() == 0) | ||||
| 		{ | ||||
| 			ERM::Tcommand &tcm = boost::get<ERM::Tcommand>(tl); | ||||
| 			ERM::Tcommand &tcm = std::get<ERM::Tcommand>(tl); | ||||
| 			if(tcm.cmd.which() == 0) | ||||
| 			{ | ||||
| 				return boost::get<ERM::Ttrigger>(tcm.cmd); | ||||
| 				return std::get<ERM::Ttrigger>(tcm.cmd); | ||||
| 			} | ||||
| 			else if(tcm.cmd.which() == 3) | ||||
| 			{ | ||||
| 				return boost::get<ERM::TPostTrigger>(tcm.cmd); | ||||
| 				return std::get<ERM::TPostTrigger>(tcm.cmd); | ||||
| 			} | ||||
| 			throw ELineProblem("Given line is not a trigger!"); | ||||
| 		} | ||||
| @@ -1533,7 +1533,7 @@ std::string ERMInterpreter::loadScript(const std::string & name, const std::stri | ||||
| 		scripts[LinePointer(static_cast<int>(buf.size()), g, buf[g].realLineNum)] = buf[g].tl; | ||||
|  | ||||
| 	for(auto p : scripts) | ||||
| 		boost::apply_visitor(ScriptScanner(this, p.first), p.second); | ||||
| 		std::visit(ScriptScanner(this, p.first), p.second); | ||||
|  | ||||
| 	std::stringstream out; | ||||
|  | ||||
| @@ -1575,7 +1575,7 @@ namespace VERMInterpreter | ||||
| { | ||||
| 	VOption convertToVOption(const ERM::TVOption & tvo) | ||||
| 	{ | ||||
| 		return boost::apply_visitor(OptionConverterVisitor(), tvo); | ||||
| 		return std::visit(OptionConverterVisitor(), tvo); | ||||
| 	} | ||||
|  | ||||
| 	VNode::VNode( const ERM::TVExp & exp ) | ||||
|   | ||||
| @@ -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!"); | ||||
| 	} | ||||
|   | ||||
| @@ -28,7 +28,7 @@ namespace phoenix = boost::phoenix; | ||||
| //Greenspun's Tenth Rule of Programming: | ||||
| //Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, | ||||
| //bug-ridden, slow implementation of half of Common Lisp. | ||||
| //actually these macros help in dealing with boost::variant | ||||
| //actually these macros help in dealing with std::variant | ||||
|  | ||||
|  | ||||
| CERMPreprocessor::CERMPreprocessor(const std::string & source) | ||||
|   | ||||
| @@ -80,7 +80,7 @@ namespace ERM | ||||
| 		Tval val; | ||||
| 	}; | ||||
|  | ||||
| 	typedef boost::variant<TVarExpNotMacro, TMacroUsage> TVarExp; | ||||
| 	typedef std::variant<TVarExpNotMacro, TMacroUsage> TVarExp; | ||||
|  | ||||
| 	//write-only variable expression | ||||
| 	struct TVarpExp | ||||
| @@ -89,7 +89,7 @@ namespace ERM | ||||
| 	}; | ||||
|  | ||||
| 	//i-expression (identifier expression) - an integral constant, variable symbol or array symbol | ||||
| 	typedef boost::variant<TVarExp, int> TIexp; | ||||
| 	typedef std::variant<TVarExp, int> TIexp; | ||||
|  | ||||
| 	struct TArithmeticOp | ||||
| 	{ | ||||
| @@ -127,7 +127,7 @@ namespace ERM | ||||
| 		TStringConstant string; | ||||
| 	}; | ||||
|  | ||||
| 	typedef boost::variant<TVarConcatString, TStringConstant, TCurriedString, TSemiCompare, TMacroDef, TIexp, TVarpExp> TBodyOptionItem; | ||||
| 	typedef std::variant<TVarConcatString, TStringConstant, TCurriedString, TSemiCompare, TMacroDef, TIexp, TVarpExp> TBodyOptionItem; | ||||
|  | ||||
| 	typedef std::vector<TBodyOptionItem> TNormalBodyOptionList; | ||||
|  | ||||
| @@ -136,9 +136,9 @@ namespace ERM | ||||
| 		char optionCode; | ||||
| 		boost::optional<TNormalBodyOptionList> params; | ||||
| 	}; | ||||
| 	typedef boost::variant<TVRLogic, TVRArithmetic, TNormalBodyOption> TBodyOption; | ||||
| 	typedef std::variant<TVRLogic, TVRArithmetic, TNormalBodyOption> TBodyOption; | ||||
|  | ||||
| //	typedef boost::variant<TIexp, TArithmeticOp > TIdentifierInternal; | ||||
| //	typedef std::variant<TIexp, TArithmeticOp > TIdentifierInternal; | ||||
| 	typedef std::vector< TIexp > Tidentifier; | ||||
|  | ||||
| 	struct TComparison | ||||
| @@ -157,7 +157,7 @@ namespace ERM | ||||
|  | ||||
| 	struct Tcondition | ||||
| 	{ | ||||
| 		typedef boost::variant< | ||||
| 		typedef std::variant< | ||||
| 			TComparison, | ||||
| 			int> | ||||
| 			Tcond; //comparison or condition flag | ||||
| @@ -196,7 +196,7 @@ namespace ERM | ||||
| 	//moreover, I encountered a quite serious bug in boost: http://boost.2283326.n4.nabble.com/container-hpp-111-error-C2039-value-type-is-not-a-member-of-td3352328.html | ||||
| 	//not sure how serious it is... | ||||
|  | ||||
| 	//typedef boost::variant<char, TStringConstant, TMacroUsage, TMacroDef> bodyItem; | ||||
| 	//typedef std::variant<char, TStringConstant, TMacroUsage, TMacroDef> bodyItem; | ||||
| 	typedef std::vector<TBodyOption> Tbody; | ||||
|  | ||||
| 	struct Tinstruction | ||||
| @@ -217,7 +217,7 @@ namespace ERM | ||||
|  | ||||
| 	struct Tcommand | ||||
| 	{ | ||||
| 		typedef	boost::variant< | ||||
| 		typedef	std::variant< | ||||
| 			Ttrigger, | ||||
| 			Tinstruction, | ||||
| 			Treceiver, | ||||
| @@ -231,7 +231,7 @@ namespace ERM | ||||
| 	//vector expression | ||||
|  | ||||
|  | ||||
| 	typedef boost::variant<Tcommand, std::string, boost::spirit::unused_type> TERMline; | ||||
| 	typedef std::variant<Tcommand, std::string, boost::spirit::unused_type> TERMline; | ||||
|  | ||||
| 	typedef std::string TVModifier; //'`', ',', ',@', '#'' | ||||
|  | ||||
| @@ -245,7 +245,7 @@ namespace ERM | ||||
|  | ||||
| 	enum EVOtions{VEXP, SYMBOL, CHAR, DOUBLE, INT, TCMD, STRINGC}; | ||||
| 	struct TVExp; | ||||
| 	typedef boost::variant<boost::recursive_wrapper<TVExp>, TSymbol, char, double, int, Tcommand, TStringConstant > TVOption; //options in v-expression | ||||
| 	typedef std::variant<boost::recursive_wrapper<TVExp>, TSymbol, char, double, int, Tcommand, TStringConstant > TVOption; //options in v-expression | ||||
| 	//v-expression | ||||
| 	struct TVExp | ||||
| 	{ | ||||
| @@ -254,7 +254,7 @@ namespace ERM | ||||
| 	}; | ||||
|  | ||||
| 	//script line | ||||
| 	typedef boost::variant<TVExp, TERMline> TLine; | ||||
| 	typedef std::variant<TVExp, TERMline> TLine; | ||||
|  | ||||
| 	template <typename T> struct ERM_grammar; | ||||
| } | ||||
|   | ||||
| @@ -662,7 +662,7 @@ void CGameHandler::endBattleConfirm(const BattleInfo * battleInfo) | ||||
|  | ||||
| 		if (finishingBattle->loserHero) | ||||
| 		{ | ||||
| 			//TODO: wrap it into a function, somehow (boost::variant -_-) | ||||
| 			//TODO: wrap it into a function, somehow (std::variant -_-) | ||||
| 			auto artifactsWorn = finishingBattle->loserHero->artifactsWorn; | ||||
| 			for (auto artSlot : artifactsWorn) | ||||
| 			{ | ||||
| @@ -3930,11 +3930,11 @@ bool CGameHandler::moveArtifact(const ArtifactLocation &al1, const ArtifactLocat | ||||
|  | ||||
| 		try | ||||
| 		{ | ||||
| 			auto hero = boost::get<ConstTransitivePtr<CGHeroInstance>>(dst.artHolder); | ||||
| 			auto hero = std::get<ConstTransitivePtr<CGHeroInstance>>(dst.artHolder); | ||||
| 			if(ArtifactUtils::checkSpellbookIsNeeded(hero, srcArtifact->artType->getId(), dst.slot)) | ||||
| 				giveHeroNewArtifact(hero, VLC->arth->objects[ArtifactID::SPELLBOOK], ArtifactPosition::SPELLBOOK); | ||||
| 		} | ||||
| 		catch(const boost::bad_get &) | ||||
| 		catch(const std::bad_variant_access &) | ||||
| 		{ | ||||
| 			// object other than hero received an art - ignore | ||||
| 		} | ||||
|   | ||||
| @@ -360,11 +360,11 @@ bool CGarrisonDialogQuery::blocksPack(const CPack * pack) const | ||||
|  | ||||
| 	if(auto arts = dynamic_ptr_cast<ExchangeArtifacts>(pack)) | ||||
| 	{ | ||||
| 		if(auto id1 = boost::apply_visitor(GetEngagedHeroIds(), arts->src.artHolder)) | ||||
| 		if(auto id1 = std::visit(GetEngagedHeroIds(), arts->src.artHolder)) | ||||
| 			if(!vstd::contains(ourIds, *id1)) | ||||
| 				return true; | ||||
|  | ||||
| 		if(auto id2 = boost::apply_visitor(GetEngagedHeroIds(), arts->dst.artHolder)) | ||||
| 		if(auto id2 = std::visit(GetEngagedHeroIds(), arts->dst.artHolder)) | ||||
| 			if(!vstd::contains(ourIds, *id2)) | ||||
| 				return true; | ||||
| 		return false; | ||||
| @@ -377,7 +377,7 @@ bool CGarrisonDialogQuery::blocksPack(const CPack * pack) const | ||||
|  | ||||
| 	if(auto art = dynamic_ptr_cast<EraseArtifactByClient>(pack)) | ||||
| 	{ | ||||
| 		if (auto id = boost::apply_visitor(GetEngagedHeroIds(), art->al.artHolder)) | ||||
| 		if (auto id = std::visit(GetEngagedHeroIds(), art->al.artHolder)) | ||||
| 			return !vstd::contains(ourIds, *id); | ||||
| 	} | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user