Created
December 17, 2011 20:01
-
-
Save lifely/1491210 to your computer and use it in GitHub Desktop.
This Hell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef FUNCTION_HPP_ | |
# define FUNCTION_HPP_ | |
#include "../etape1/FunctionSignature.hpp" | |
#include <iostream> | |
template <typename T> | |
class Function | |
{ | |
public: | |
Function() { std::cout << "Create Basic" << std::endl; }; | |
~Function(void) { std::cout << "Destroy Basic" << std::endl; }; | |
Function & operator=(T (*func)()) | |
{ | |
this->f = func; | |
std::cout << "Bidule Shouette" << std::endl; | |
return this; | |
}; | |
T operator()() | |
{ return f(); }; | |
public: | |
FunctionSignature<T()>f; | |
}; | |
template<typename T, typename A> | |
class Function<T(A)> | |
{ | |
public: | |
Function(T(A)) { std::cout << "Create Specialized" << std::endl; }; | |
~Function(void) { std::cout << "Destroy Specialized" << std::endl; }; | |
Function<T(A)> & operator=(T (*func)(A)) | |
{ | |
this->f = func; | |
std::cout << func << std::endl; | |
return *this; | |
}; | |
T operator()(A arg) | |
{ return f(arg); }; | |
public: | |
T (*f)(A); | |
}; | |
#endif // !FUNCTION_HPP_ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment