From c169085cc9a9eb9c7c911d1b68db1f08a95c0d27 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Mon, 26 Jan 2015 16:17:03 +0100 Subject: disable alternate Php::Function constructor on compilers that do not support it (fix for issue #164) --- include/function.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/function.h b/include/function.h index 7073f84..e6693d7 100644 --- a/include/function.h +++ b/include/function.h @@ -39,17 +39,24 @@ public: * @param function The C++ function to be wrapped */ Function(const std::function &function); - + /** * Constructor to wrap a function that does not accept parameters + * + * Old C++ compilers do not see a difference between std::function + * objects based on the function signature, so these old compilers + * do not see this method. + * * @param function The C++ function to be wrapped */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 7) || __clang__ Function(const std::function &function) : Function([function](Parameters ¶ms) -> Value { // call original function, forget about the parameters return function(); }) {} +#endif /** * Destructor -- cgit v1.2.3