]> www.ginac.de Git - ginac.git/blobdiff - doc/examples/compile2.cpp
[C++20] Clean up using-declarations.
[ginac.git] / doc / examples / compile2.cpp
index 1d344dd4d49b8cc857424625caf6305d73292326..960bbed9091c8e658a3df297b076bf3175e6c977 100644 (file)
@@ -1,10 +1,11 @@
 #include <iostream>
-using namespace std;
 #include <ginac/ginac.h>
-using namespace GiNaC;
 // Yes, we are using CUBA (should be installed on the system!)
 #include <cuba.h>
 
+using namespace std;
+using namespace GiNaC;
+
 /*
  * Demonstrates the use of compile_ex with the CUBA library.
  *
@@ -22,7 +23,7 @@ int main()
        cout << "Enter an expression containing 'x' and/or 'y': ";
        cin >> s;
        // Expression now in expr
-       ex expr(s, lst(x,y));
+       ex expr(s, lst{x,y});
  
        cout << "start integration of " << expr << " ..." << endl;
 
@@ -43,7 +44,10 @@ int main()
 
        // Our function pointer that points to the compiled ex
        FUNCP_CUBA fp;
-       compile_ex(lst(expr), lst(x,y), fp);
+
+       // Optionally, compile with custom compiler flags:
+       // setenv("CXXFLAGS", "-O3 -fomit-frame-pointer -ffast-math", 1);
+       compile_ex(lst{expr}, lst{x,y}, fp);
 
        // Starting VEGAS
        // By invocation of compile() the expression in expr is converted into the