| 
				
				
				
				 | 
			
			 | 
			@@ -1,33 +1,25 @@ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include <utility>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include <iostream>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			template<typename fun, typename... Ts>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			class Dispatcher {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			public:
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  void dispatch(int x, Ts&& ...args) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (x > 0)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      call<int>(std::forward<Ts>(args)...);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    else
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			      call<double>(std::forward<Ts>(args)...);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			template<template<typename T> class F, typename... Ts>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			void dispatch(int x, Ts&& ...args) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  if (x > 0)
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    F<int>()(std::forward<Ts>(args)...);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  else
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    F<double>()(std::forward<Ts>(args)...);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			protected:
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  template<typename T>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  void call(Ts&& ...args) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    throw std::runtime_error("Not implemented");
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			template<typename T>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			struct bla {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  void operator()(int&& a, char&& b, double&& c) const {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    std::cout << typeid(T).name() << " " << a << " " << b << " " << c << std::endl;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  }
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			};
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			class bla {};
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			template<> template<typename T>
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			void Dispatcher<bla, int, char, double>::call(int&& a, char&& b, double&& c) {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::cout << typeid(T).name() << " " << a << " " << b << " " << c << std::endl;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			main() {
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  std::cout << "main()" << std::endl;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  Dispatcher<bla, int, char, double> d;
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  d.dispatch(5, 1, 'a', 5.5);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  d.dispatch(-5, 1, 'a', 5.5);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  //bla<double>()(1, 'a', 5.5);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  dispatch<bla, int, char, double>(5, 1, 'a', 5.5);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			  dispatch<bla, int, char, double>(-5, 1, 'a', 5.5);
 | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			}
 |