- 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 
                        template<typename T, typename T1>
	class TSwitch
	{
		private:
			std::function<T1(T)> _functionSwitch;
			std::function<void(T)> _defaultFunction;
			std::map<T1, std::function<void(T)> > _map;
		private:
			IActorPtr _protocol;
			IActorPtr _port;
			IActorPtr _listParam;
			IActorPtr _managerData;
		public:
		TSwitch(std::function<T1(T)> functionSwitch,std::map<T1, std::function<void(T)> > mapSwitch):_functionSwitch(functionSwitch)
																									,_defaultFunction([](T value){std::cout<<"no way";})
																									,_map(mapSwitch){}
		TSwitch(std::function<T1(T)> functionSwitch, std::function<void(T)> defaultValue,std::map<T1, std::function<void(T)> > mapSwitch):_functionSwitch(functionSwitch)
																																		,_defaultFunction(defaultValue)																																,_map(mapSwitch){}
		virtual ~TSwitch(){}
		public:
			void switches(T value)
			{
				auto it=_map.find(_functionSwitch(value));
				if (it==_map.end()) {_defaultFunction(value); return;}
				it->second(value);
			}
	};
                                     
        
            Вот такая  замена switch. Отстойно не правда-ли?