Possibility to pass class method reference
[command.git] / tests / argument / handles_float_value.cpp
index 3fd86fb9bc8b6021cb63199c1444003ce7cded9b..f757a84f1e7c20e63a2b6261654c8fd3798bdcd9 100644 (file)
@@ -11,19 +11,23 @@ typedef float ArgumentType;
 
 ArgumentType test;
 
-void function(ArgumentType value) {
+void _function(ArgumentType value) {
     test = value;
 }
 
 int main() {
-    Argument<ArgumentType> argument("Argument as float", function);
+    Argument<ArgumentType> argument("Argument as float", _function);
 
     if (argument.understand(VALUE)) {
         argument.handle();
     }
+    else {
+        cout << argument.describe() << " do not understand float values\n";
+        return 1;
+    }
 
     if (test == std::stof(VALUE)) {
-        cout << "Argument class handles float values\n";
+        cout << argument.describe() << " handles float values\n";
         return 0;
     }