#pragma once /* * FunctionList.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * * License: GNU General Public License v2.0 or later * Full text of license available in license.txt file, in main folder * */ /// List of functions that share the same signature - can be used to call all of them easily template class CFunctionList { public: std::vector > funcs; CFunctionList(int){}; CFunctionList(){}; template CFunctionList(const Functor &f) { funcs.push_back(boost::function(f)); } CFunctionList(const boost::function &first) { if (first) funcs.push_back(first); } CFunctionList(std::nullptr_t) {} CFunctionList & operator+=(const boost::function &first) { funcs.push_back(first); return *this; } void add(const CFunctionList &first) { for (size_t i = 0; i < first.funcs.size(); i++) { funcs.push_back(first.funcs[i]); } } void clear() { funcs.clear(); } operator bool() const { return funcs.size(); } void operator()() const { std::vector > funcs2 = funcs; //backup for(size_t i=0;i void operator()(const Arg & a) const { std::vector > funcs2 = funcs; //backup for(int i=0;i void operator()(Arg1 & a, Arg2 & b) const { std::vector > funcs2 = funcs; //backup for(int i=0;i