summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-26 16:17:03 +0100
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2015-01-26 16:17:03 +0100
commitc169085cc9a9eb9c7c911d1b68db1f08a95c0d27 (patch)
treeb31ea742862e38768e164969923aaae33ee8ce06
parent2c86787c663e2877777af61128c24230b1d04e03 (diff)
disable alternate Php::Function constructor on compilers that do not support it (fix for issue #164)v1.3
-rw-r--r--include/function.h9
1 files changed, 8 insertions, 1 deletions
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<Value(Parameters&)> &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<Value()> &function) : Function([function](Parameters &params) -> Value {
// call original function, forget about the parameters
return function();
}) {}
+#endif
/**
* Destructor