]> www.ginac.de Git - ginac.git/commitdiff
[DOC] Update the tutorial for GiNaC::function resolution. master
authorVladimir V. Kisil <V.Kisilv@leeds.ac.uk>
Thu, 3 Jul 2025 22:03:41 +0000 (00:03 +0200)
committerRichard Kreckel <kreckel@ginac.de>
Thu, 3 Jul 2025 22:03:41 +0000 (00:03 +0200)
Issue was reported by Warren Weckesser.

Signed-off-by: Vladimir V. Kisil <V.Kisilv@leeds.ac.uk>
doc/tutorial/ginac.texi

index 33e9abbac5a8d6727ae932a8de7a04e8e26aae96..3f8fcd1a56dba8572278bca271aaf337f3f8938a 100644 (file)
@@ -6534,8 +6534,8 @@ programming languages, you can always traverse the expression tree yourself:
 @example
 static void my_print(const ex & e)
 @{
 @example
 static void my_print(const ex & e)
 @{
-    if (is_a<function>(e))
-        cout << ex_to<function>(e).get_name();
+    if (is_a<GiNaC::function>(e))
+        cout << ex_to<GiNaC::function>(e).get_name();
     else
         cout << ex_to<basic>(e).class_name();
     cout << "(";
     else
         cout << ex_to<basic>(e).class_name();
     cout << "(";
@@ -6553,11 +6553,16 @@ static void my_print(const ex & e)
 
 int main()
 @{
 
 int main()
 @{
-    my_print(pow(3, x) - 2 * sin(y / Pi)); cout << endl;
+    symbol x("x"), y("y");
+    my_print(pow(3, x) - 2 * sin(y / Pi));
+    cout << endl;
     return 0;
 @}
 @end example
 
     return 0;
 @}
 @end example
 
+(Note that we have added the namespace resolution to the @code{GiNaC::function}
+class to avoid modern compilers' confusion with @code{std::function}.)
+
 This will produce
 
 @example
 This will produce
 
 @example